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

[chore] cleanup server CLI / environment / configuration file parsing #1244

Open
NyaaaWhatsUpDoc opened this issue Dec 9, 2022 · 2 comments
Labels
chore a pain in the butt that needs doing cli Command-line interface related config Something needs to be made configurable, or there's a config issue enhancement New feature or request

Comments

@NyaaaWhatsUpDoc
Copy link
Member

NyaaaWhatsUpDoc commented Dec 9, 2022

Current issues:

  • we accept almost every single configuration variable as CLI flags, our usage printing is already rather absurd but it will get worse as we add more configurables
  • all of our configuration variables live at the root json / toml / yaml "namespace"
  • ephemeral configurables are stored in the main configuration struct, and available all over the codebase via config.Get___() despite only ever being used in cmd/gotosocial/action/...
  • we have no way of outputting updated configuration files based on current settings

My proposed change:

  • we drastically reduce the CLI flags that we support to only the essentials to get the server running: e.g. ports, lets-encrypt, config path, database, storage path
  • move configuration variables into grouped structures e.g. DatabaseConfiguration{}, StorageConfiguration{} etc
  • ephemeral configurables are passed to gts action functions by means of context variables
  • move debug config action to be under config dump-json, and then add dump-yaml and dump-toml actions to allow printing current configuration to file. useful if you have an old configuration file that you want to easily update with the latest flags without manually doing it
  • to make migration from old configuration file format easier, create a cmd/config-migrate utility that allows converting from old to new configuration file format. environment variable parsing and those relying on CLI flags will unfortunately run into breakages, but ultimately we are alpha and I don't think many will be relying on them for the finer configurables (e.g. oidc)
@NyaaaWhatsUpDoc NyaaaWhatsUpDoc added enhancement New feature or request config Something needs to be made configurable, or there's a config issue cli Command-line interface related chore a pain in the butt that needs doing labels Dec 9, 2022
@NyaaaWhatsUpDoc
Copy link
Member Author

@tsmethurst if you're good with this, I have the start of some changes, and the rest of them ready in my head :)

@tsmethurst
Copy link
Contributor

@NyaaaWhatsUpDoc should we still consider this issue open? Or should we close it? I don't think we're having too much trouble with our config stuff these days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore a pain in the butt that needs doing cli Command-line interface related config Something needs to be made configurable, or there's a config issue enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants