How can I arrange conditional branching in truffle migration based on the chosen of the network for migration(development, ropsten, main, etc) or based on the Linux environment variables?


The signature of the migration script function is:

module.exports = function (deployer, network, accounts) {

If you want to branch depending on which network you are, you can check the network parameter.

If you wish to use environment variables, you can access these via process.env.<VARIABLE>.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.