-
Notifications
You must be signed in to change notification settings - Fork 157
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
Split configuration #209
Comments
An example for some of the ideas is home assistant: https://www.home-assistant.io/docs/configuration/splitting_configuration/ |
Ah yes, this is a good idea. I think that perhaps having a placeholder type thing would be good: mqtt:
host: test.mosquitto.org
user: {{ env("MQTT_USER", "my_default_user") }} This is the same syntax I use for https://github.com/flyte/confp (which could be used for this in the meantime), and it means we can just run the config file through Jinja2 first, then load it as normal. I'll have a look at confp to see if it's possible to just utilise that as a dependency, since it might make things more flexible by being able to load values not just from env vars, but from etcd, redis, S3 etc. as well (or anywhere really, by writing a new module for confp). |
As far as splitting up config files goes, I'm not really convinced about that yet. I know some people use this software for much larger projects than I have, but we don't have comprehensive automation scripts and such like Home Assistant does, so I can't imagine config files getting too complicated to necessitate splitting. Happy to be proven otherwise though. |
Another benefit of using Jinja2 is that loops and conditionals can be used. That might make config files much less tedious to write, for example: mqtt:
host: test.mosquitto.org
user: myuser
password: {{ env("MQTT_PASS") }}
gpio_modules:
- name: pcf
module: pcf8574
digital_inputs:
{% for i in range(8) %}
- name: pcf{{ i }}
pin: {{ i }}
module: pcf
{% endfor %} |
Hey @flyte wondering if you had a chance to document how you would pass environment variables via docker container? I would gladly submit a PR if I knew what looks like. Thoughts? docker-compose.yml
config.yml
|
Thanks to @pmgledhill102 I was able to render environmental variables using the following configuration on Fedora 36 IoT / Rpi3. config.yml
render.yml
testing it
|
I'm using git to manage configuration files and I don't want to commit passwords to git.
I would like to be able to split up the configuration in multiple files or load some config from another location. That way I could commit the not-secret-configuration only.
Some ideas:
password_from_file
)The text was updated successfully, but these errors were encountered: