diff --git a/docker/compose.with-database-grafana.yml b/docker/compose.with-database-grafana.yml index d72d7e7..1833916 100644 --- a/docker/compose.with-database-grafana.yml +++ b/docker/compose.with-database-grafana.yml @@ -32,6 +32,7 @@ services: OPENDTU_PASSWORD: ${OPENDTU_PASSWORD} TIMESCALEDB_ENABLED: ${TIMESCALEDB_ENABLED} TZ: ${TZ} + LOG_LEVEL: ${LOG_LEVEL} depends_on: timescaledb: condition: service_healthy diff --git a/docker/compose.with-database.yml b/docker/compose.with-database.yml index 277ee63..fdbb400 100644 --- a/docker/compose.with-database.yml +++ b/docker/compose.with-database.yml @@ -32,6 +32,8 @@ services: OPENDTU_PASSWORD: ${OPENDTU_PASSWORD} TIMESCALEDB_ENABLED: ${TIMESCALEDB_ENABLED} TZ: ${TZ} + LOG_LEVEL: ${LOG_LEVEL} + depends_on: timescaledb: condition: service_healthy diff --git a/docker/compose.yml b/docker/compose.yml index 2c29835..5d60048 100644 --- a/docker/compose.yml +++ b/docker/compose.yml @@ -11,6 +11,7 @@ services: OPENDTU_PASSWORD: ${OPENDTU_PASSWORD} TIMESCALEDB_ENABLED: ${TIMESCALEDB_ENABLED} TZ: ${TZ} + LOG_LEVEL: ${LOG_LEVEL} depends_on: timescaledb: condition: service_healthy diff --git a/docker/example.env b/docker/example.env new file mode 100644 index 0000000..aa51cd1 --- /dev/null +++ b/docker/example.env @@ -0,0 +1,11 @@ +# OpenDTU +OPENDTU_ADDRESS="192.168.1.89:80" +OPENDTU_AUTH=false +OPENDTU_USERNAME= +OPENDTU_PASSWORD= + +# OpenDTU Logger +DB_URL="host=timescaledb port=5432 user=postgres password=secret dbname=opendtu_logger sslmode=disable" +TIMESCALEDB_ENABLED=true +TZ="Europe/Amsterdam" +LOG_LEVEL=INFO" \ No newline at end of file diff --git a/docker/example.with-database.env b/docker/example.with-database.env index 5131f51..d6cd1d8 100644 --- a/docker/example.with-database.env +++ b/docker/example.with-database.env @@ -3,10 +3,13 @@ OPENDTU_ADDRESS="192.168.1.89:80" OPENDTU_AUTH=false OPENDTU_USERNAME= OPENDTU_PASSWORD= + # OpenDTU Logger DB_URL="host=timescaledb port=5432 user=postgres password=secret dbname=opendtu_logger sslmode=disable" TIMESCALEDB_ENABLED=true TZ="Europe/Amsterdam" +LOG_LEVEL=INFO" + # Database configuration PG_USER=postgres PG_PASSWORD= diff --git a/main.go b/main.go index 60d76ae..ac98c20 100644 --- a/main.go +++ b/main.go @@ -232,6 +232,7 @@ func loadConfig() Config { config.TimescaleDB = timescaleDB } config.TZ = os.Getenv("TZ") + config.LogLevel = os.Getenv("LOG_LEVEL") } _, err = time.LoadLocation(config.TZ) if err != nil { diff --git a/systemd/opendtu-logger.service b/systemd/opendtu-logger.service index 60fa257..88ad6ad 100644 --- a/systemd/opendtu-logger.service +++ b/systemd/opendtu-logger.service @@ -23,6 +23,8 @@ Environment="OPENDTU_PASSWORD=your_super_secret_password" Environment="DB_URL=host=localhost port=5432 user=postgres password=secret dbname=dtu sslmode=disable" Environment="TIMESCALEDB_ENABLED=true" Environment="TZ=Europe/Amsterdam" +Environment="LOG_LEVEL=INFO" + WorkingDirectory=/opt/opendtu-logger/ ExecStart=/opt/opendtu-logger/opendtu-logger