matrix-org / matrix-authentication-service

OAuth2.0 + OpenID Provider for Matrix Homeservers
https://matrix-org.github.io/matrix-authentication-service/
Apache License 2.0
109 stars 32 forks source link

Document the config merge strategy #3136

Open HarHarLinks opened 3 weeks ago

HarHarLinks commented 3 weeks ago

https://github.com/matrix-org/matrix-authentication-service/blob/d3eb5be63ead3078f71f142785fc3768dcd7bcd8/docs/setup/general.md?plain=1#L50

but it's not explained how configs get merged in theory. will values from second.yaml overwrite those in first.yaml or reverse? or is it illegal to try this?

sandhose commented 2 weeks ago

We're using figment under the hood, with the merge strategy, meaning that later values are generally preferred. Not sure whether this is the right approach or not; it may make more sense to switch to the adjoin strategy, where the first config files take precedence, and arrays get merged?

https://docs.rs/figment/latest/figment/struct.Figment.html#conflict-resolution

HarHarLinks commented 1 week ago

merge strategy meets what I would have guessed but could not be sure. Whether you decide to change it or not, this issue is about documenting your approach so that the reader may create their config appropriately.

matrixbot commented 6 days ago

For your information, this issue has been copied over to the Element fork of matrix-authentication-service: https://github.com/element-hq/matrix-authentication-service/issues/3136