-
Notifications
You must be signed in to change notification settings - Fork 280
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
Override config via environment #107
Comments
I agree it could be cool. But I'd rather have a YAML-formatted config, like for the By the way, did you know you can already use this? YAMLLINT_CONFIG="{extends: relaxed, rules: {line-length: {max: 81}}}"
yamllint -d "$YAMLLINT_CONFIG" foo.yaml |
Didn't. Thanks!
I considered format as well; suggested something different than YAML in my original comment because I felt a simpler dot notation was closer to your average bash experience. I guess it doesn't scale as well, but the idea was to have the option of changing "just the one thing"; not really passing a full config. I guess there are two minor opportunities for improvements here. Consider a use case similar to: # Override while calling this docker instance in your CI pipeline
ENV YAML_ARGS=""
# ...
CMD ["yamllint", "-d '${YAML_ARGS}'"]
..and overriding this from your ci script.
$ docker run --rm -v $(PWD):/yaml sdesbure/yamllint yamllint -d "" .gitlab-ci.yml
invalid config: not a dict
I guess both can be handled in wrappers but I thought it be worth bringing it up. Feel free to close this issue unless you feel we should make either improvement actionable. |
Hey, Both 1. and 2. make sense! |
This is a "minor" abi break since empty configs are disregarded instead of failing. Fixes: adrienverge#107
@adrienverge When I have config in file and want just to override one rule, can I do it with existing mechanism somehow ? |
@grzesuav you can do this: YAMLLINT_CONFIG="{extends: /my/config/file.yaml, rules: {line-length: {max: 20}}}"
yamllint -d "$YAMLLINT_CONFIG" foo.yaml |
ok, thanks :) anyway I think overriding specific setting with env variable would be useful in this case. Do you have any preference around the behavior ? |
When playing with dockerfiles and multiple repos (main usecase for me is part of CI) it would be nice to be able to override specific config settings via environment; for instance
YAMLLINT_CONFIG="line-length.max=81" yamllint foo.yaml
. This makes it easier to override a few settings without having to check in a config in each repo you're testing against.The text was updated successfully, but these errors were encountered: