Implement env-var-checks

f_influxdb-line-protocol
Ruakij 3 years ago
parent f596a99ee6
commit 1012001312

@ -25,9 +25,14 @@ const env = process.env;
env.LOGLEVEL ??= "INFO"; env.LOGLEVEL ??= "INFO";
env.WIFI_INTERFACE ??= "wlan0"; env.WIFI_INTERFACE ??= "wlan0";
env.HOSTNAME ??= Os.hostname(); env.HOSTNAME ??= Os.hostname();
env.USE_INFLUXDB_LINEPROTOCOL ??= false;
} }
// Required vars // Required vars
let errorMsg = requireEnvVars([ let errorMsg = requireEnvVars(
env.USE_INFLUXDB_LINEPROTOCOL? [ // When lineprotocol is enabled, we need host and port
"INFLUXDB_LINEPROTOCOL_HOST", "INFLUXDB_LINEPROTOCOL_PORT",
] : [ // When its disabled, influxdb-data
"INFLUX_URL", "INFLUX_TOKEN", "INFLUX_URL", "INFLUX_TOKEN",
"INFLUX_ORG", "INFLUX_BUCKET" "INFLUX_ORG", "INFLUX_BUCKET"
]); ]);

Loading…
Cancel
Save