Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate and Resolve issues with Raw Config Deserializer #334

Closed
bconn98 opened this issue Dec 16, 2023 · 1 comment · Fixed by #339
Closed

Investigate and Resolve issues with Raw Config Deserializer #334

bconn98 opened this issue Dec 16, 2023 · 1 comment · Fixed by #339

Comments

@bconn98
Copy link
Collaborator

bconn98 commented Dec 16, 2023

The following config is deserialized as valid and should not. Discovered while testing #332

refresh_rate: 30 seconds
appenders:
  stdout:
    kind: console
  requests:
    kind: file
    path: "log/requests.log"
    encoder:
      pattern: "{d} - {m}{n}"
    root:
    level: warn
    appenders:
        - stdout
    loggers:
    app::backend::db:
        level: info
    app::requests:
        level: info
        appenders:
        - requests
        additive: false
@bconn98
Copy link
Collaborator Author

bconn98 commented Jan 20, 2024

The bug was that we just verified serde could parse the config, not that our tool liked the config. Suggesting the following patch to resolve:

diff --git a/src/config/raw.rs b/src/config/raw.rs
index 77963ed..171d1a1 100644
--- a/src/config/raw.rs
+++ b/src/config/raw.rs
@@ -525,6 +525,7 @@ loggers:
         let config_str = sample_file[config_start..config_end].trim();
 
         let config = ::serde_yaml::from_str::<RawConfig>(config_str);
-        assert!(config.is_ok())
+        assert!(config.is_ok());
+        assert!(crate::init_raw_config(config.unwrap()).is_ok());
     }
 }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant