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

fix: allow to override some nested values in config. #374

Merged
merged 1 commit into from
Jul 21, 2021

Conversation

harnash
Copy link
Contributor

@harnash harnash commented Jul 15, 2021

Currently it is not possible to override some values in the config if they are nested such as SELFSERVICE_METHODS_OIDC_CONFIG_PROVIDERS. It is still not possible to override some values that are nested inside array but this at least should allow to replace the whole array with some serialized JSON struct. It is not ideal but it should have some more options to deal with injecting secrets into Kratos et al.

Related issue(s)

This is a follow up on ory/kratos#1535

Checklist

  • I have read the contributing guidelines
    and signed the CLA.
  • I have read the security policy.
  • I confirm that this pull request does not address a security
    vulnerability. If this pull request addresses a security vulnerability, I
    confirm that I got green light (please contact
    [email protected]) from the maintainers to push
    the changes.
  • I have added tests that prove my fix is effective or that my feature
    works.
  • I have added necessary documentation within the code base (if
    appropriate).

Further comments

My initials investigation showed that even if I can generate nested keys for elements inside JSON arrays it is still hard to (impossible? knadh/koanf#74) to make koanf to properly set those variables into the config:

I[#/selfservice/methods/oidc/config/providers] S[#/properties/selfservice/properties/methods/properties/oidc/properties/config/properties/providers/type] expected array, but got string

For reference Viper seems to support such cases (see: https://github.com/spf13/viper#accessing-nested-keys) and I know Viper is different kind of beast and has it's own set of problems but perhaps it is wise to look for alternative? Another option might be to use combined config that are merged into one (still not ideal but would help with secrets handling?).

@harnash harnash changed the title Allow to override some nested values in config. fix: allow to override some nested values in config. Jul 15, 2021
Copy link
Member

@aeneasr aeneasr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thank you!

@aeneasr aeneasr merged commit 5616ea3 into ory:master Jul 21, 2021
@harnash harnash deleted the env_config_nested_variables branch July 21, 2021 19:48
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 this pull request may close these issues.

2 participants