Skip to content

Commit

Permalink
chore(backend): move part of the config values into environment varia…
Browse files Browse the repository at this point in the history
…bles as default
  • Loading branch information
Data5tream committed Jul 26, 2023
1 parent 06340f6 commit 2abebb0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 13 deletions.
12 changes: 0 additions & 12 deletions config_example.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
[webserver]
host = "0.0.0.0"
port = 8080
url = "http://localhost"

[redis]
url = "redis://redis:6379/0"

[watcher]
interval = 30
watchlist = [
{ id = "serv", name = "Local dev", kind = "url", target = "http://localhost:8080/" }
]

[log]
level = "info"
path = "/var/log/status-page.log"
7 changes: 7 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ services:
- backend
app:
image: ghcr.io/data5tream/simple-status-page:latest
environment:
- APP_WEBSERVER_HOST="0.0.0.0"
- APP_WEBSERVER_PORT="8080"
- APP_WEBSERVER_URL="http://localhost"
- APP_REDIS_URL="redis://redis:6379/0"
- APP_LOG_LEVEL="info"
- APP_LOG_PATH="/var/log/status-page.log"
ports:
- "8080:8080"
networks:
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pub fn get_config() -> Config {
.add_source(config::File::with_name("config"))
// Add in settings from the environment (with a prefix of APP)
// Eg.. `APP_DEBUG=1 ./target/app` would set the `debug` key
.add_source(config::Environment::with_prefix("APP"))
.add_source(config::Environment::with_prefix("APP").separator("_"))
.build()
.expect("Invalid or missing config file")
}
Expand Down

0 comments on commit 2abebb0

Please sign in to comment.