Skip to content
This repository has been archived by the owner on Nov 8, 2024. It is now read-only.

CLI params should override dredd.yaml #455

Open
tu1ly opened this issue Apr 21, 2016 · 14 comments
Open

CLI params should override dredd.yaml #455

tu1ly opened this issue Apr 21, 2016 · 14 comments
Labels
behavior change aka breaking change Epic: configuration Command line options, dredd init, dredd.yml

Comments

@tu1ly
Copy link

tu1ly commented Apr 21, 2016

current:
if dredd.yaml is present then CLI params are not taken into the consideration
expected:
CLI params should override dredd.yaml params

@tu1ly tu1ly added improvement behavior change aka breaking change labels Apr 21, 2016
@honzajavorek honzajavorek changed the title cli params should oweride dredd.yaml CLI params should override dredd.yaml Apr 21, 2016
@andyantrim
Copy link

I agree, also it should be done on a one by one basis, so that if you have a yaml but want to, say change the hooks file, you can pass --hookfiles to override that current setting quickly

@smizell
Copy link
Contributor

smizell commented May 11, 2016

@andyantrim @tu1ly would you all be able to maybe provide a simply use case here? As in, what is the situation where you would want to override hook files? What are the benefits this functionality would give you? What other configurations have you wanted to override? Thanks a lot!

@andyantrim
Copy link

@tu1ly thanks for the reply, one instance I've found is when I want to use hookfiles or not, so I have the dress.yml file and if I run dredd blueprint.MD --hookfiles=hooks.oh --language python it should take in the stuff from the yaml and also override any params I pass in. I'm currently running against a mock (built to perfectly mirror the docs) and our actual implementation of the API, to check they match so the API endpoint is different! I get that maybe this case is best to just not use the yaml (which is what I'm doing atm) and the mock takes no hooks,

Thanks

@smizell
Copy link
Contributor

smizell commented May 11, 2016

Very cool! So you're mainly changing the URL Dredd calls and the hookfiles?

@andyantrim
Copy link

Yes I'm not sure about node, but if there could be an option to default the yaml values and then have any CLI params override that! But yes, this is my use case! Thanks guys!

@smizell
Copy link
Contributor

smizell commented May 11, 2016

@andyantrim Thanks for fielding all my questions. This decision for a feature like this will be handled by @netmilk, but I'm curious if your use case would be helped by having multiple configuration files instead of overwriting values?

@w-vi
Copy link
Contributor

w-vi commented May 11, 2016

Just to add my 5 cents, overriding config file values from CLI is a common and sensible thing. Look at git or gdb or just any more complex command, the usual behaviour is that config file is the default and it gets get overridden by CLI specified values.

@honzajavorek
Copy link
Contributor

I remember @netmilk told me this should be current behavior already except for blueprint and endpoint (see reference). I didn't have time to try out what actually works now and what does not.

What you describe here is probably already implemented (except for those two). Of course, there might be a bug. Also, it's subject for discussion whether the two properties shouldn't be also allowed to override as when they're not it can be confusing.

@aledeg
Copy link

aledeg commented Jun 7, 2016

It would be nice to be able to override blueprint and endpoint as well on CLI.

@hueter
Copy link

hueter commented Jun 22, 2016

+1

@honzajavorek
Copy link
Contributor

What is actually the reason you usually need to override the API description and/or the server? Debugging? Trying whether a different server fits the same description? I'm trying to understand the common behavior properly.

@victorsferreira
Copy link

hello, everyone
is there anything new about this?

is there a way to skip the dredd.yml file or override its values?

@victorsferreira
Copy link

victorsferreira commented Mar 13, 2019

By the way, as an alternative I renamed dredd.yml to something else and now I call dredd in two different ways:

$ dredd <specs> <endpoint> -g <my command>
$ dredd --config <dredd config>

@honzajavorek
Copy link
Contributor

@victorsferreira All options except of the API description and the server URL should be possible to override. Overriding the two needs a larger changes, roughly outlined in #1101

As a workaround, you can have multiple dredd.yml files and switch between them using the --config option. See an example in the dredd-example repository.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
behavior change aka breaking change Epic: configuration Command line options, dredd init, dredd.yml
Projects
None yet
Development

No branches or pull requests

8 participants