Skip to content

[RFC] Persist settings in a file or environment #2

Description

@rochacbruno

Right now the current version of galaxykit requires passing credentials and server URL as argument.

As a user I want to provide my settings in settings file following something like the XDG based spec

Examples:

when running $ galaxykit at the time of instantiation of a new GalaxyClient it will look for the existence of the following configuration files, in the exact order.

./galaxykit.cfg  # current working directory or $XDG_RUNTIME_DIR
~/home/user/.galaxykit.cfg  # $HOME/.file.cfg
~/home/user/.config/galaxykit.cfg  # $XDG_CONFIG_HOME/file.cfg
~/home/user/.config/galaxykit/config.cfg  # $XDG_CONFIG_HOME/dir/file.cfg
/etc/galaxykit/config.cfg                                

On the open desktop spec those directories are defined by $HOME and $XDG_CONFIG_HOME and it is a common pattern to follow it.

It will load data from multiple files, but don't override existing values.

Any of the config keys can be overwritten by export GALAXYKIT_ prefixed environment variable.

proposals

  • Implement the XDG file lookup internally to keep the low dependency design recommended
  • Use python-xdg lib
  • Use a settings library such as dynaconf or pydantic
  • reuse ansible.cfg (is that an option?)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions