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

config::Override implementation not being called #819

Open
cbrit opened this issue Feb 8, 2023 · 1 comment
Open

config::Override implementation not being called #819

cbrit opened this issue Feb 8, 2023 · 1 comment

Comments

@cbrit
Copy link

cbrit commented Feb 8, 2023

Rust: 1.67
Abscissa: 0.6.0

I have a bool config field config.simulate.enabled that I'd like to override with the start command flag --simulate. My override looks like this:

impl config::Override<StewardConfig> for StartCmd {
    fn override_config(&self, mut config: StewardConfig) -> Result<StewardConfig, FrameworkError> {
        if self.simulate {
            config.simulate.enabled = self.simulate;
        }

        Ok(config)
    }
}

The config value is not being updated even though the flag is set. I've tried logging inside of override_config() to see if it is entered at all in case the value is is overwritten somewhere else, and it seems that the method is never actually called.

2023-02-08T15:05:23.769547Z  INFO steward::commands::start: simulate flag: true, simulate enabled in config: false

If it were working, both would be true

@aawsome
Copy link

aawsome commented May 8, 2023

I think you should call it by yourself, e.g. by using/providing process_config() in your Configurable impl, e.g. something like

process_config(&self, config: StewardConfig) -> ... {
  match &self.cmd {
    ...:Start(cmd) => cmd.override_config(config),
    _ => Ok(config),
  }
}

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

No branches or pull requests

2 participants