We have a repository with metadata in source format, and we use sfdx and ci job to deploy, some metadata (Named Credentials for this instance) contains some values that are env/org dependant.

For the example above, we need to replace endpoint, username, and password depending on the env/org we are deploying to with CI job.

Is there anything like dotenv for PHP to do that?

<?xml version="1.0" encoding="UTF-8"?>
<NamedCredential xmlns="http://soap.sforce.com/2006/04/metadata">
  • Don't know about any tool to do this. But I'd remove the named credentials from VCS as it is contains secrets and put them in .gitignore. Instead develop some script to create the named credentials in the target org (probably using SOAP API).
    – ondrakr
    Apr 22, 2022 at 17:59

1 Answer 1


I found a workaround, i use .env files to store environement variables and i use a GitHub Workflow to substitute values in the metadata files, passwords/usernames/and tokens are stored as GitHub secrets and substituted also during deployment like env variables.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .