From 3428a637ce420baef9aa9f9803e71bd587867005 Mon Sep 17 00:00:00 2001 From: FxQnLr Date: Wed, 10 Apr 2024 00:16:55 +0200 Subject: Closes #24. Changed postgres to json directory storage --- src/config.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/config.rs') diff --git a/src/config.rs b/src/config.rs index 9636af4..124893b 100644 --- a/src/config.rs +++ b/src/config.rs @@ -5,7 +5,6 @@ use crate::auth; #[derive(Debug, Clone, Deserialize)] pub struct Config { - pub database_url: String, pub serveraddr: String, pub pingtimeout: i64, pub pingthreshold: i64, @@ -26,9 +25,10 @@ impl Config { .set_default("pingtimeout", 10)? .set_default("pingthreshold", 1)? .set_default("timeoffset", 0)? + .set_default("auth.secret", "")? .add_source(File::with_name("config.toml").required(false)) .add_source(File::with_name("config.dev.toml").required(false)) - .add_source(config::Environment::with_prefix("WEBOL").prefix_separator("_")) + .add_source(config::Environment::with_prefix("WEBOL").separator("_")) .build()?; config.try_deserialize() -- cgit v1.2.3 From bd5ed2f47fe870776783a5b2a56c899126a51860 Mon Sep 17 00:00:00 2001 From: FxQnLr Date: Wed, 10 Apr 2024 12:20:17 +0200 Subject: Closes #29. Usable Readme and hopefully versioned container --- .github/workflows/push.yml | 1 + README.md | 27 +++++++++++++++++++++++---- src/config.rs | 1 + src/main.rs | 1 - 4 files changed, 25 insertions(+), 5 deletions(-) (limited to 'src/config.rs') diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index c04a19a..bdedfee 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -47,3 +47,4 @@ jobs: tags: | ghcr.io/fxqnlr/webol:dev-latest ghcr.io/fxqnlr/webol:dev-${{ github.run_number }} + ghcr.io/fxqnlr/webol:${{ env.CARGO_PKG_VERSION }} diff --git a/README.md b/README.md index eabc051..88f786a 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,28 @@ # webol -DATABASE_URL: `String` +## Config +Default `config.toml`: +```toml +serveraddr = "0.0.0.0:7229" # String +pingtimeout = 10 # i64 +pingthreshold = 1 # i64 +timeoffset = 0 # i8 -WEBOL_APIKEY: `String` +[auth] +method = "none" # "none"|"key" +secret = "" # String +``` -WEBOL_SERVERADDR: `Option` (0.0.0.0:7229) +## Docker -WEBOL_PINGTIMEOUT: `Option` (10) +minimal `docker-compose.yaml`: +```yaml +services: + webol: + image: ghcr.io/fxqnlr/webol:0.4.0 + container_name: webol + restart: unless-stopped + volumes: + - ./devices:/devices + network_mode: host +``` diff --git a/src/config.rs b/src/config.rs index 124893b..bfb28be 100644 --- a/src/config.rs +++ b/src/config.rs @@ -25,6 +25,7 @@ impl Config { .set_default("pingtimeout", 10)? .set_default("pingthreshold", 1)? .set_default("timeoffset", 0)? + .set_default("auth.method", "none")? .set_default("auth.secret", "")? .add_source(File::with_name("config.toml").required(false)) .add_source(File::with_name("config.dev.toml").required(false)) diff --git a/src/main.rs b/src/main.rs index cf0d39b..779385f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -68,7 +68,6 @@ impl Modify for SecurityAddon { } #[tokio::main] -#[allow(deprecated)] async fn main() -> color_eyre::eyre::Result<()> { color_eyre::install()?; -- cgit v1.2.3