We have an application which uses JSON file to define the the connection strings and credentials of the databases and other APIs. Ideally those credentials are added as variable into the bitbucket repo and replaced during build time in Jenkins.
The developers replace them when working with them in their local.
We need to find a way so that they do not commit those credentials mistakenly to bitbucket. They must replace the connections with their respective variables before committing. Eg:
Connection_string:DATABASE_CONN_STRING,
Also those files cannot be added to .gitignore as there are multiple changes to key values in the file during development which is needed to commit to bitbucket. We are using Jenkins as our CI/CD tool.
Any help will be appriciated. Or if anyone could guide my what is the better process to do this.