Add configurable LOG_LEVEL env vars.
This commit is contained in:
parent
b63c1e85d3
commit
3556e401bc
7 changed files with 21 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
11
docker/example.env
Normal file
11
docker/example.env
Normal file
|
@ -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"
|
|
@ -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=
|
||||
|
|
1
main.go
1
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 {
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue