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

Unify command line arguments with environment variables & config file #192

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

Conversation

dovreshef
Copy link

to:
cc: @subspacecommunity/subspace-maintainers
related to:
resolves:

Background

We have some parameters which are passed on the command line and some which are read from environment variable.
And we have to know which is which. There is also no centralized location where all the start up config is documented.

This PR uses the Cobra library in conjunction with the Viper library to unify all of our startup configuration.
It still does not support all of the configuration from the command line (it's too much). But anything that can be configured from the command line can be configured instead from either a config file or an environment variable. Or a combination of all of these.

I've taken care to keep all environment variables and command line parameters as they were. But this PR is nonetheless a breaking change. Go cli library uses one dash for options, wherein Cobra, like other unix tools, uses double dash for options.

Testing

I've added some basic tests.

@sonarcloud
Copy link

sonarcloud bot commented Jun 13, 2021

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

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