File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -58,9 +58,21 @@ module PlaceOS::Source
5858 end
5959 end
6060
61+ # Configure the database connection. First check if PG_DATABASE_URL environment variable
62+ # is set. If not, assume database configuration are set via individual environment variables
63+ if pg_url = ENV [" PG_DATABASE_URL" ]?
64+ PgORM ::Database .parse(pg_url)
65+ else
66+ PgORM ::Database .configure { |_ | }
67+ end
68+
6169 publisher_managers = [] of PublisherManager
6270
63- publisher_managers << MqttBrokerManager .new
71+ if PlaceOS ::Model ::Broker .count > 0
72+ publisher_managers << MqttBrokerManager .new
73+ else
74+ puts " skipping Mqtt Broker\n "
75+ end
6476
6577 influx_host, influx_api_key = INFLUX_HOST , INFLUX_API_KEY
6678
@@ -71,14 +83,6 @@ module PlaceOS::Source
7183 publisher_managers << InfluxManager .new(influx_host, influx_api_key)
7284 end
7385
74- # Configure the database connection. First check if PG_DATABASE_URL environment variable
75- # is set. If not, assume database configuration are set via individual environment variables
76- if pg_url = ENV [" PG_DATABASE_URL" ]?
77- PgORM ::Database .parse(pg_url)
78- else
79- PgORM ::Database .configure { |_ | }
80- end
81-
8286 # Start application manager
8387 manager = Manager .new(publisher_managers)
8488 manager.start
You can’t perform that action at this time.
0 commit comments