famedly / famedly-sync

GNU Affero General Public License v3.0
4 stars 0 forks source link

Refactor config functionality to support configuration through environment variables #33

Closed tlater-famedly closed 2 months ago

tlater-famedly commented 2 months ago

Description

The ldap-sync tool should support multiple sources of configuration, both a configuration file and configuration via environment variables. Currently only the configuration file is supported.

This can either be implemented manually, or a crate like https://docs.rs/config or https://docs.rs/figment could be used. While we use config in other crates, it is semi-unmaintained, so figment might be the better choice.

Requirements

### Tasks
- [x] Component can be configured according to the requirements
- [x] All requirements have tests
mzaniolo commented 2 months ago

What should happen if the file doesn't exist? Should it just fail or should it try to read every config filed from the env vars?

tlater-famedly commented 2 months ago

What should happen if the file doesn't exist? Should it just fail or should it try to read every config filed from the env vars?

It should try to fill the config with env vars. The practical use case for this is kubernetes, where we want to do configuration with environment variables as much as possible.