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

Feature Request: Support Variables in config { .... } and multiple configs for deep merging in a single source #42

Closed
osterman opened this issue Dec 24, 2020 · 1 comment · Fixed by #43

Comments

@osterman
Copy link
Sponsor

what

  • support variables in config {....} block
  • support multiple files passed to source

why

  • Make it easy to pass a list of YAML configurations that get deep merged

use-case

  • We define a import directive in our atmos cli configuration that we use to layer configurations on top of each other
  • We need this in order to support this behavior
mumoshu added a commit that referenced this issue Jan 5, 2021
To better support the use-case of dynamically generating configs from other configs and variables, the following changes are made:

- Added `paths` to `file` config source. Either the existing `path` or `paths` is required.
   - All the files listed in `paths` are merged using `mergo` with `mergo.WithOverride` and `mergo.WithOverwriteWithEmptyValue`
- config source's `paths` and `path` can now refer to `var`s. `variant` internally builds a DAG of `var`s, `conf`s, and `sec`s to make it possible.
- Added `function` block to define user-functions, with support for recursive call. Note that user-functions are visible within a variant command that defines it.
  - This means two things:
    - You can't `import` user-functions
    - User-functions defined in the parent variant command are not visible to imported variant commands.
- Added new example for config-depends-on-var use-case at `examples/advanced/dynamic-config-inheritance`
- Added new example for importing variant command with local user-function at `examples/advanced/userfunc-local-scope`

Resolves #42
@mumoshu
Copy link
Owner

mumoshu commented Jan 5, 2021

@osterman This sounds like a great addition!

I've released v0.37.0 for this initial attempt to support this, which should be available within a few minutes. Please try and don't hesitate to leave any feedback/requests.

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.

2 participants