jbake
jbake copied to clipboard
Override Config/Environment-based Config Files
I saw #490 but I'm looking for more of a global override. The use case is as follows:
- I set up my site with CI to deploy to production for the
master
branch and staging for anything else - In production, the site is the root content, but in staging, the site is in a subdirectory (i.e. example.com/ for production and dev.example.com/static/ for staging)
- For each environment, I'd like to at least modify the
site.host
config value, but there might be other config values that could be useful to change per-environment that I haven't thought of.
Possible implementations:
- Enable individual config overrides through a command line flag
jbake generate --config "site.host=https://example.com"
- Enable declaring an alternate config file
jbake generate --config-file production.properties
I think the second would probably be the easier of the two to implement, though the first would allow for less copy/paste for shared config between multiple environments.
If this is something you'd be interested in implementing, I'd be happy to contribute the code myself (I just wanted to get the conversation started before I went ahead and did anything)
I like that. Would be a nice addition. How do you help yourself at present? Are you using sed for an inline replacement of values or do you copy property file templates per environment?
At the moment I don't deploy from CI, I just build and archive the artifacts and manually push after manually modifying the config, but I was going to set up something with sed
before I realized I'm probably not the only one who would benefit from this.
This may already be possible through the SystemConfiguration option by defining a system property on the command line, although the order of loading probably needs to be altered so anything defined on the command line overrides any values in the config files.