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

Support More Flexible Config File Path #264

Open
xM8WVqaG opened this issue Jun 12, 2023 · 0 comments
Open

Support More Flexible Config File Path #264

xM8WVqaG opened this issue Jun 12, 2023 · 0 comments

Comments

@xM8WVqaG
Copy link

configFilePath is currently hardcoded to ${HOME:-$USERPROFILE}/.replicated/config.yaml which isn't very flexible and doesn't follow expectations of modern programs. In sandboxed environments these directories may not be writable or appropriate.

func configFilePath() string {
      return path.Join(homeDir(), ".replicated", "config.yaml")
}

https://github.com/replicatedhq/replicated/blob/main/pkg/credentials/credentials.go#L100

It would be useful if this supported other directories. For example, if replicated followed the XDG Base Directory specification standard.

This doesn't need to be done in-house, there are already packages in go which "do the right thing" for all platforms, like arg which makes this line something like:

func configFilePath() string {
      return xdg.ConfigFile("replicated/config.yaml")
}

Which would (by default) evaluate to ~/.config/replicated/config.yaml on Linux and ~/Library/Application Support/replicated/config.yaml on MacOS.

Failing that, adding a REPLICATED_CONFIG_HOME env var would make it easy to change this directory, but seeing as the only thing it currently contains is the REPLICATED_API_TOKEN that might not be a desirable solution.

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

No branches or pull requests

1 participant