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

need clean way to over-ride config in dev without having to check-in sensitive properties to scm #387

Closed
ptrthomas opened this issue May 4, 2018 · 2 comments
Assignees
Milestone

Comments

@ptrthomas
Copy link
Member

ptrthomas commented May 4, 2018

here's what I'm thinking:

  • karate will also look for a file karate-config-<env>.js where env is the value of karate.env
  • the default dir where this will be looked for is ~/.karate so that this file will never be checked into scm by mistake, so sensitive 'secrets' can go here
  • this 'over-ride' file will merge the JSON returned with what was returned by karate-config.js. values in the karate-config-<env>.js will "win"
  • we will support an additional command-line property called karate.config.dir. if present, karate will look here FIRST for both the karate-config.js and the 'over-ride' file. loading from classpath:karate-config.js will continue to work. but only one karate-config.js will be processed. this additional mechanism is expected to make it simpler for CI jobs to over-ride config.
  • good to have: support a -Dkarate.options="-a foo=bar -a ban=baz" way to over-ride config properties via the command line, aligned with the standalone jar command-line syntax
  • related to the above, I'm not keen on auto-adding any system property to the config 'property bag' for multiple reasons (clutters the config, may break existing behavior, too much magic)
  • instead framework developers can always call java.lang.System.getProperty('your.name') and plug them into the config if really needed. for example invent a custom strategy that any system property starting with overwatch. e.g. overwatch.foo=bar would be injected into the config as { foo: 'bar' }
@ptrthomas ptrthomas added this to the v0.8.0 milestone May 4, 2018
@ptrthomas ptrthomas self-assigned this May 4, 2018
@ptrthomas
Copy link
Member Author

whoa, on second thoughts, changing second point to be NOT a global path because there will obviously be many karate projects on the same machine !

  • the default dir where this will be looked for is ${project.basedir}/.karate so that this file will never be checked into scm by mistake, so sensitive 'secrets' can go here

Also wondering if the karate.config.dir can be over-ridable within karate-config.js itself, for e.g. with an additional API on the karate JS object

karate.configure('configDir', './conf');

which may be super-flexible.

ptrthomas added a commit that referenced this issue Jun 5, 2018
karate.config.dir can set the dir in which config files will be looked for
if karate.env is set, karate-config-<env>.js will be looked for in the config dir which defaults to .karate in working dir
working dir should be the maven project base dir / or within the root
so teams can keep env over-rides in this one file
@ptrthomas ptrthomas added the fixed label Jun 5, 2018
ptrthomas added a commit that referenced this issue Jun 11, 2018
read the doc edits in this commit for the details
ptrthomas added a commit that referenced this issue Jun 26, 2018
if a classpath:karate-base.js exists, it will be processed first
@ptrthomas
Copy link
Member Author

released 0.8.0

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

1 participant