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

Configuration Via Environment Variables #72

Open
danieledwardgeorgehitchcock opened this issue Jan 30, 2025 · 5 comments
Open

Configuration Via Environment Variables #72

danieledwardgeorgehitchcock opened this issue Jan 30, 2025 · 5 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@danieledwardgeorgehitchcock

Hi,

Given that Docker is now an option for installation, it'd be great if the application could be configured via Environment variables.

@chrivers
Copy link
Owner

This is not impossible, but it is a bit tricky. The config.yaml file for bifrost contains structured data, not just a flat list of key=value pairs, so it doesn't map super cleanly to environment settings.

It would also make the setup procedure have even more branching directions, and it's already complicated enough, I think.

Something I do have planned, is adding an environment var to specify the location of config.yaml and state.yaml, though.

@chrivers
Copy link
Owner

Is there a specific use case you have in mind, or a certain problem you're trying to solve?

@danieledwardgeorgehitchcock
Copy link
Author

danieledwardgeorgehitchcock commented Jan 30, 2025

The reason this config via Environment Variables would be of an advantage is in an infrastructure as code environment such as docker-compose.

An example (which I feel ties in quite nicely with it's symbiosis) of how a structured configuration via environment variables can be achieved is Z2M itself to which, a basic config for Bifrost can be achieved with something like the following in a docker-compose file:

services:
  bifrost:
    image: ghcr.io/chrivers/bifrost:latest
    container_name: bifrost
    restart: unless-stopped
    network_mode: host
    environment:
      BIFROST_CONFIG_BIFROST_CERT_FILE: certs/cert.pem
      BIFROST_CONFIG_BRIDGE_NAME: Bifrost
      BIFROST_CONFIG_BRIDGE_MAC: 00:11:22:33:44:55
      BIFROST_CONFIG_BRIDGE_IPADDRESS: 10.12.0.20
      BIFROST_CONFIG_BRIDGE_NETMASK: 255.255.255.0
      BIFROST_CONFIG_BRIDGE_GATEWAY: 10.12.0.1
      BIFROST_CONFIG_BRIDGE_TIMEZONE: Europe/Copenhagen
      BIFROST_CONFIG_Z2M_SERVER1_URL: ws://10.0.0.100:8080

This would allow for configuration to be applied at runtime which could help with more complicated infrastructure configurations such as docker swarm or kubernetes

@danieledwardgeorgehitchcock
Copy link
Author

This is not impossible, but it is a bit tricky. The config.yaml file for bifrost contains structured data, not just a flat list of key=value pairs, so it doesn't map super cleanly to environment settings.

It would also make the setup procedure have even more branching directions, and it's already complicated enough, I think.

Something I do have planned, is adding an environment var to specify the location of config.yaml and state.yaml, though.

This would be super useful for having the yaml's in a separate directory and using docker volumes :-)

@chrivers
Copy link
Owner

chrivers commented Feb 4, 2025

Having an environment variables point to a yaml file to load is much, much easier than somehow supporting putting all config values into the environment.

I'll mark this issue as a feature request for that :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants