Usage of variables files¶
Prerequisites¶
Modules
Checkout branches
git checkout origin/osp-web-configuration .
git checkout origin/osp-variables-configuration .
Example configuration
git checkout origin/template-variables-file .
Description¶
In this tutorial you will learn how to create a variables value with a default extracted from a variables.ospp.
Steps¶
1. Create a value and his owner¶
The default is directly extracted from the variables.ospp.
root/final/value.ospp
{
"name": "Example value",
"description": "Example value",
"type": "TEXT"
}
root/final/owner.variables
{
"moduleId": "modules.variables.variables-1",
"default": "${default-value}",
"variablesFiles": [
"root.variables"
]
}
root/variables/variables.ospp
{
"variables": {
"default-value": "My content"
},
"variablesFiles": [
"root.variables.sub"
]
}
Which result in the following owner.
2. Redefine the default value inside the owner¶
The default is overridden by the locally define one.
root/redefine/value.ospp
{
"name": "Example value",
"description": "Example value",
"type": "TEXT"
}
root/redefine/owner.variables
{
"moduleId": "modules.variables.variables-1",
"default": "${default-value}",
"variablesFiles": [
"root.variables"
],
"templateVariables": {
"default-value": "My new content"
}
}
root/variables/variables.ospp
{
"variables": {
"default-value": "My content"
},
"variablesFiles": [
"root.variables.sub"
]
}
Which result in the following owner as the default-value
define on the root.redefine/owner.ospp
is overriding the one define on root.variables/variables.ospp
.
3. Use variables from a sub variables file¶
The default is overridden by the locally define one and add a new variable.
root/sub-variables/value.ospp
{
"name": "Example value",
"description": "Example value",
"type": "TEXT"
}
root/sub-variables/owner.variables
{
"moduleId": "modules.variables.variables-1",
"default": "${default-value}",
"variablesFiles": [
"root.variables"
],
"templateVariables": {
"default-value": "My new content is [${content}]"
}
}
root/variables/variables.ospp
{
"variables": {
"default-value": "My content"
},
"variablesFiles": [
"root.variables.sub"
]
}
root/variables/sub/variables.ospp
{
"variables": {
"content": "A message"
}
}
Which result in the following owner as the default-value
define on the root.sub-variables/owner.ospp
is overriding the one define on root.variables/variables.ospp
and use content
define on root.variables.sub/variables.ospp
.