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

Move /etc/sonic.cfg to /run/sonic/sonic.cfg #325

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

agowa
Copy link

@agowa agowa commented Sep 22, 2024

When using this container in docker-compose it is not that easy to bind mount a file into the container. It has a way better user experience when one can just specify a folder. Currently this doesn't work with the default configuration as the sonic.cfg is directly within /etc. By replacing /etc/sonic.cfg with a symlink to /run/sonic/sonic.cfg we can solve this issue and also introducing a breaking change.

When using this container in docker-compose it is not that easy to bind mount a file into the container. It has a way better user experience when one can just specify a folder. Currently this doesn't work with the default configuration as the sonic.cfg is directly within /etc.
By replacing /etc/sonic.cfg with a symlink to /run/sonic/sonic.cfg also avoid introducing a breaking change.
@pirate
Copy link

pirate commented Dec 31, 2024

Instead of run, how about /etc/sonic/sonic.cfg? I think it's still config, not runtime state, so something under /etc/... makes more sense.

It's common to check $XDG-CONFIG too when checking /etc, but I don't personally need it 🤷‍♂️

  • /etc/sonic/sonic.cfg (lowest precedence)
  • ~/.config/sonic/sonic.cfg (optional, check for user config which overrides system config)
  • ⬇️ environment variables (per-run env vars are highest precedence)

@agowa
Copy link
Author

agowa commented Jan 5, 2025

I picked /run/sonic cause the sonic container is kinda stateless and the config was generated upon runtime. However /etc/sonic/sonic.cfg would also work.

I wouldn't recommend ~/.config/sonic/sonic.cfg, or $XDG-CONFIG for a container, they've kinda bad user experience in this context.

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