How to overwrite with default value from outside a class #382
-
Hi everyone. I'm experimenting with Pkl hoping to use it to generate some of our Prometheus alerts since we have a lot of copy paste happening. My idea is to bundle my alerts into modules and just amend them where change needs to happen (for example a different env) I'm experimenting a lot but general idea is like this
And I have another file
What I am trying to do is set defaults for various things but lets say for the annotations I want those to be global inside my alerts.pkl and unless specifieded inside the alerts and overwriting it, to use the global default.. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I think this is how it's done in Pkl. The main trick is to leverage Listing.default by setting
|
Beta Was this translation helpful? Give feedback.
I think this is how it's done in Pkl. The main trick is to leverage Listing.default by setting
rules.default
inbasealerts.pkl
and usingnew {
instead ofnew SingleAlert {
inalerts.pkl
: