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?

1 Answer 1


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>.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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