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

Command line config #30

Open
smellsblue opened this issue Oct 14, 2015 · 2 comments
Open

Command line config #30

smellsblue opened this issue Oct 14, 2015 · 2 comments

Comments

@smellsblue
Copy link
Contributor

This has been in the back of my head for a while, and has been referenced in #28, so I figured I would put my thoughts here.

Right now, all config is handled via a config file, but it would be neat to support all configuration directly as config options as well.

@indirect suggested -h/--host, -p/--port and -b/--bind, which we could expand to all the config options.

Another route I've thought about was along the lines of ssh config. For example, you can run ssh user@host -o Port=22 or ssh user@host -o "Port 22". You can also use all those config in your ssh config file, just like we would support in Gemstash.

Thus, it might look like this:

$ gemstash start --config bind=tcp://0.0.0.0:4242 --config rubygems_url=https://gemfury.io
$ gemstash start -c bind=tcp://0.0.0.0:4242 -c rubygems_url=https://gemfury.io

Would these command line options override any config found in the configuration file, even if a specific --config-file is provided? I would think yes, the command line should override.

Thoughts?

@pcarranza
Copy link
Contributor

Override, yes, makes sense with the things like the sherpa mode and else.

I also could not find the host to bind to, so I went the binding way, and I think that it actually makes sense to do it that way.

@olleolleolle
Copy link
Member

olleolleolle commented Dec 8, 2016

To save a thought here, I'd mention that Thor supports "key:value key2:value2" Hash options, which perhaps we can abuse to get something we can use for the above-mentioned use-case.

Adding a Thor option definition to cli.rb:

    method_option :config, :type => :hash, :desc =>
      "Config options to override when starting key:value key2:value format"

We could perhaps find a way to get it into the Configuration, later.

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

No branches or pull requests

4 participants