Skip to content

How to apply update's automatically onto my configs #1029

Answered by bioball
mbauhardt asked this question in Q&A

You must be logged in to vote

If you have known values that you'd like to be able to override from the CLI, you should look into using read() for that. For example, your code can look like:

amends "AccountConfig.pkl"

accounts {
  ["team-a"] = read?("prop:team-a") ?? "1234"
  ["team-b"] = read?("prop:team-b") ?? "4321"
}

Then, you can eval via:

pkl eval -p team-a=1000 myModule.pkl

If you don't have a program that allows you to override specific values using read(), -x is a good escape hatch (like you mentioned). For example:

pkl eval -x "(module) { accounts { [\"team-a\"] = \"$number\" } }.output.text" myModule.pkl

This is a little more fragile, though, because you are relying on shell scripting to construct valid Pkl…

Replies: 1 comment 7 replies

You must be logged in to vote
7 replies
@mbauhardt

@StefMa

@mbauhardt

@bioball

Answer selected by mbauhardt
@bioball

@mbauhardt

@bioball

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants