Per-machine and per-run settings#
Both tasks use CUE package mode: the environment file starts with a package clause, and kevin loads every .cue file in the directory with the same clause as one environment.
Keep machine-specific values out of source control#
Add a package clause to the top of
kevin.cue:package kevinAdd a local file to
.gitignore:echo 'kevin.local.cue' >> .gitignorePut the machine-specific values in
kevin.local.cue, with the same package clause:package kevin plugins: registry: config: token: "local-dev-token"Check the result:
kevin validate
kevin ignores a .cue file that does not have the same package clause, so check that kevin.local.cue has it.
Switch a setting on the command line#
Mark the field with a
@tagattribute in a package-mode file:package kevin proxy: egress: deny: bool @tag(airgap,type=bool)Pass the tag:
kevin run -t airgap
-t airgap is the same as -t airgap=true. Use -t name=value for a string or number field.
Use one switch for several fields#
Declare the switch as its own field, then use it in an if block:
package kevin
airgap: bool | *false @tag(airgap,type=bool)
proxy: egress: deny: airgap
if airgap {
domain: "airgap.kevin.home"
}Use an if block to change a field that already has a default, such as domain. Do not replace the default with an expression, such as domain: *myDomain | string: kevin keeps the original default, kevin.home, and reports no error.
Related#
- Environment file: tags
- Environment file: package mode
- Variables - a
--var/var-file/environment-variable alternative that needs no CUE package mode