-
Notifications
You must be signed in to change notification settings - Fork 86
CxConfigProvider
DhavalPatelPersistent edited this page Jan 13, 2022
·
3 revisions
CxConfigProvider is a Configuration library used by CxFlow. It reads configurations in a JSON or YAML formats from .checkmarx
folder in the root of a Git repository.
- Implemented in plain Java
- Supports files in 2 formats: JSON and YAML.
- Can load files from
.checkmarx
folder in the root of a Git repository. - Support for nesting configurations
- Can resolve parameters inside the configuration
github:
token: ${GITHUB_TOKEN}
configAsCode: cx.configuration
ast:
apiUrl: "http://this.is.just.an.example"
token: ${AST_TOKEN}
preset: true
incremental: false
Unlike normal YAML files, the configuration can have variables. The variables are resolved as follows:
- ${XXX} - will be resolved to the system environment variable with the name XXX. ex. ${AST_TOKEN}
- ${path.in.config} - will be resolved to the value inside the configuration. ex. ${ast.preset} is true
- \"TEST\" - TEST is a value that should not be resolved. ex. \"this is a normal text with special characters like $ and { \"
{
"github": {
"token": ${GITHUB_TOKEN},
"configAsCode": "cx.configuration"
},
"ast": {
"apiUrl": "http://this.is.just.an.example",
"token": ${AST_TOKEN},
"preset": true,
"incremental": false
}
}
Unlike normal JSON files, the configuration is HOCON and can have variables. The variables are resolved; if the value is not quoted as follows:
- ${XXX} - will be resolved to the system environment variable with the name XXX. ex. ${AST_TOKEN}
- ${path.in.config} - will be resolved to the value inside the configuration. ex. ${ast.preset} is true
note: if the value is quoted, the variables will not be resolved. ex. "this is a normal text with special characters like $ and { "
For more information visit Cx-ConfigProvider