String Replacements During Install
During artifact installation, sfp automatically applies string replacements to convert placeholder values to environment-specific values based on the target org.
How It Works
When installing artifacts with embedded replacement configurations:
- Org Detection: Identifies the target org alias and whether it's a sandbox or production org
- Value Resolution: Determines the appropriate replacement value based on org alias or defaults
- File Modification: Applies replacements to matching files before deployment
- Deployment: Deploys the modified components to the target org
Environment Resolution
Replacements are resolved in this order:
- Exact alias match: If the org alias matches a configured environment
- Default value: For sandbox/scratch orgs when no exact match is found
- Error: For production orgs without explicit configuration
Installation Output
During installation with replacements, you'll see:
Text replacements for org alias dev (sandbox)
Total replacement configs 3
Modified APIService.cls with 2 replacements
Modified ConfigService.cls with 1 replacements
Replacements summary: 3 replacements in 2 files using dev environmentCommand Line Options
Disable Replacements
To skip replacements during installation:
sfp install --targetorg dev --artifactdir artifacts --no-replacementsOverride Replacements
To use a custom replacement configuration file:
sfp install --targetorg dev --artifactdir artifacts --replacementsoverride custom-replacements.ymlProduction Deployments
Production deployments require explicit configuration for the org alias. If no configuration is found, the installation will fail:
ERROR: No replacement value found for production org with alias 'prod'
Production deployment requires explicit configuration for alias 'prod' in replacement 'API Endpoint'Troubleshooting
No Replacements Applied
- Verify the artifact was built with replacements embedded
- Check that glob patterns match your files
- Ensure the org alias has configured values
Wrong Values Applied
- Verify org alias with
sf org list - Check environment resolution order
- Ensure production orgs have explicit configuration