Set property on all existing elements in a listing #530
Answered
by
bioball
cloudflight-cweiss
asked this question in
Q&A
-
Maybe it is already mentionend in the language reference somewhere but I could not find it so here it goes... I have a setup where I preset a number of "default tenants" which are used on mostly all deployed instances. module listmodify
tenants: Listing<Tenant>
class Tenant {
tenant: String
login: Login
}
class Login {
username: String
password: String
} Now i have a file for defining the default tenants: amends "listmodify-template.pkl"
tenants {
new {
tenant = "AT"
}
new {
tenant = "DE"
}
new {
tenant = "CZ"
}
} And now i want to generate a fully filled out config for my local environment for example: amends "default-tenants.pkl"
local defaultLogin = new Login {
username = "admin"
password = "admin"
}
// TODO: Set login property on all existing tenant elements
tenants {
} How can I set the login property on all existing elements in the "tenants" listing? |
Beta Was this translation helpful? Give feedback.
Answered by
bioball
Jun 14, 2024
Replies: 1 comment 1 reply
-
Use a member predicate, where the predicate is simply amends "default-tenants.pkl"
local defaultLogin = new Login {
username = "admin"
password = "admin"
}
tenants {
[[true]] {
login = defaultLogin
}
} |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
cloudflight-cweiss
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use a member predicate, where the predicate is simply
true
: