We are developing a blockchain web application (dApp). Of course we need to have the dApp present in mainnet, testnet and devnet. Therefor, we need to have ENVs for the smart contracts and other blockchain data, like the RPCs and Chain ID.
Currently we are running a setup of 3 repositories. CloudFlare allows only a Page per repository, I already tried to have 3 pages pointing to three branches in a single repository, but it doesn't allow me to do so. So basically devnet repo is a fork of testnet, and testnet a fork of mainnet. Currently our devs are not allowed to push to mainnet and testnet, only through PRs, with reviews and approvals from code owners. I was wondering if there is a better setup for this or if I am missing something.
Now the main issue that I am facing:
Previously we had the ENVs in a .env file inside the repository. The problem was that on every PR, there were merge conflicts beacuse each repo has a different set of values. So I removed this file, and I added the ENV vars directly in CloudFlare Pages.
When we try to do some local development, without that file, there are no ENVs, so we have errors. I know that we can have .env.mainnet, .env.testnet, .env.devnet inside the repository and we can source locally based on need. But I feel like maybe there are other ways to do this, because, for example, if I have to update an ENV inside .env.devnet, of course I will need to update the ENV in CloudFlare side. So it turns out to be a 2 step process, even a 3 step process if I update README aswell.
Do we have a better way to load ENV vars locally if they are already setup in CloudFlare without adding more steps in the process?