@cbs-consulting/generate-default-env
v1.0.0
Published
Generate default-env.json from .cdsrc-private.json CF bindings
Downloads
65
Readme
@cbs-consulting/generate-default-env
Generate default-env.json from .cdsrc-private.json Cloud Foundry bindings.
This utility automatically fetches Cloud Foundry service credentials and generates a default-env.json file that can be used for local development or in CI/CD pipelines.
Installation
npm install @cbs-consulting/generate-default-envUsage
Command Line
After installation, you can use the CLI command:
# Generate default-env.json using the 'hybrid' profile
generate-default-env hybrid
# Specify output file
generate-default-env hybrid default-env.json
# Specify workspace root directory
generate-default-env ownHDI gen/db/default-env.json /path/to/workspaceParameters
- profile (optional, default:
hybrid): The profile name from.cdsrc-private.json(without brackets) - outputFile (optional, default:
default-env.json): Path where the output file will be written - workspaceRoot (optional, default: current directory): Directory containing
.cdsrc-private.json
Configuration
The tool reads from .cdsrc-private.json in your workspace root. Example structure:
{
"requires": {
"[hybrid]": {
"db": {
"kind": "hana",
"binding": {
"apiEndpoint": "https://api.cf.example.com",
"org": "my-org",
"space": "dev",
"instance": "my-hdi-container",
"key": "my-service-key"
},
"vcap": {
"name": "my-hdi-db"
}
},
"xsuaa": {
"kind": "xsuaa",
"binding": {
"apiEndpoint": "https://api.cf.example.com",
"org": "my-org",
"space": "dev",
"instance": "my-xsuaa",
"key": "my-xsuaa-key"
}
}
}
}
}Output
The tool generates a default-env.json file with the following structure:
{
"VCAP_SERVICES": {
"hana": [
{
"name": "my-hdi-db",
"instance_name": "my-hdi-container",
"label": "hana",
"tags": ["hana"],
"plan": "standard",
"credentials": {
"host": "...",
"port": "...",
"user": "...",
"password": "...",
"schema": "..."
}
}
]
},
"TARGET_CONTAINER": "my-hdi-db"
}