Last active
April 19, 2023 18:37
-
-
Save pivotaljohn/7adda56da6e48970027453916b33029e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#@ load("@ytt:overlay", "overlay") | |
#@ load("@ytt:toml", "toml") | |
#@ def app_config_secret(): | |
kind: Secret | |
metedata: | |
name: app-config | |
#@ end | |
#@ def add_locale(conf_str): | |
#@ # parse to Starlark `dict`s and `list`s: | |
#@ conf = toml.decode(conf_str) | |
#@ | |
#@ conf["Global"]["locale"] = "Amsterdam" | |
#@ | |
#@ # create a new section by adding an empty dictionary | |
#@ conf["Locales"] = {} | |
#@ conf["Locales"]["Amsterdam"] = {} | |
#@ conf["Locales"]["Amsterdam"]["max_instances"] = 15 | |
#@ conf["Locales"]["Amsterdam"]["min_instances"] = 4 | |
#@ | |
#@ # encode to TOML-formatted string | |
#@ return toml.encode(conf) | |
#@ end | |
#@overlay/match by=overlay.subset(app_config_secret()) | |
--- | |
stringData: | |
#@overlay/replace via=lambda old, new: add_locale(old) | |
app.conf: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kind: Secret | |
metedata: | |
name: app-config | |
stringData: | |
app.conf: | | |
[Global] | |
user = "FOO\\bar" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment