Questions about dfx.json configuration
In development, there is often a distinction between the development environment and the production environment. In the development environment, we often use some test containers. These test containers are only used for testing in the development environment. In the production environment, we don’t need to use them. But because in dfx.json, I did not find out how to distinguish the container configuration between the development environment and the production environment. The following is an example.
dfx.json // Used in local development environment
{
"canisters": {
"TestDB": {
"main": "./test/TestDB.mo",
"type": "motoko"
},
"TestPool": {
"main": "./test/TestPool.mo",
"type": "motoko"
},
"main": {
"main": "./main.mo",
"type": "motoko"
}
},
"defaults": {
"build": {
"packtool": "vessel sources"
}
},
"dfx": "0.8.0",
"networks": {
"local": {
"bind": "127.0.0.1:8000",
"type": "ephemeral"
}
},
"version": 1
}
When I launch production and release, I may only use main.mo
{
"canisters": {
"main": {
"main": "./main.mo",
"type": "motoko"
}
},
"defaults": {
"build": {
"packtool": "vessel sources"
}
},
"dfx": "0.8.0",
"networks": {
"local": {
"bind": "127.0.0.1:8000",
"type": "ephemeral"
}
},
"version": 1
}
In this case, it is easy to cause confusion in the production and development environment
I don’t know if other developers have found this kind of problem