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

from_env_keys() is not properly implemented for nested config structs. #3

Open
N4D1K-lgtm opened this issue May 7, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@N4D1K-lgtm
Copy link
Owner

Example:

#[derive(Config, Serialize, Deserialize, Debug, Default)]
pub struct AppConfig {
    #[config(key = "DEBUG_MODE")]
    pub debug: bool,
    #[config(nest)]
    pub mailbox: MailboxConfig,
    #[config(nest)]
    pub web: WebConfig,
    #[config(nest)]
    pub notifications: NotificationConfig,
    #[config(nest)]
    pub cobbler: CobblerConfig,
    #[config(nest)]
    pub ipa: IPAConfig,
    #[config(nest)]
    pub cli: CliConfig,
    #[config(nest)]
    pub metrics: MetricsConfig,
}

println!("Environment Variables: {:?}", AppConfig::get_env_keys());

This should traverse each nested config struct and get their env keys. However currently it just outputs the field names.

Environment Variables: 
{
  "mailbox": "MAILBOX",  
  "cli": "CLI", 
  "ipa": "IPA", 
  "metrics": "METRICS", 
  "debug": "DEBUG_MODE", 
  "cobbler": "COBBLER", 
  "notifications": "NOTIFICATIONS", 
  "web": "WEB"
}
@N4D1K-lgtm N4D1K-lgtm self-assigned this May 7, 2024
@N4D1K-lgtm N4D1K-lgtm added the bug Something isn't working label May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant