-
Notifications
You must be signed in to change notification settings - Fork 26
Description
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.