EDIT: I was wrong. See posts below instead There is the field canisters.<canister name>.args in dfx.json that takes a string with a candid argument inside to use when deploying the canister. Is this sufficient or is it necessary to have network-specific arguments?
Which option do you mean exactly?
Accept a file path as part of dfx.json’s canisters.<canister name>.args field or
Installing canisters...
Error: Failed while trying to deploy canisters.
Caused by: Failed while trying to deploy canisters.
Failed while trying to install all canisters.
Failed to install wasm module to canister 'evm_rpc'.
Failed to create argument blob.
Invalid data: Expected arguments but found none.
Turns out I’m bad at reading our own code. Quoting from the dfx.json schema:
init_arg: The Candid initialization argument for installing the canister. If the --argument or --argument-file argument is also provided, this init_arg field will be ignored.
args: This field defines an additional argument to pass to the Motoko compiler when building the canister.
Is there any way to put shell escapes into init_arg like I would use $(dfx canister id <name>) in a dfx deploy command? Or some other way to achieve a “dynamic” init_arg?
Right now we don’t have a way to make arguments dynamic, but we’ve shortlisted this feature request as one of the things we want to do in the very near future (although not scheduled yet)
Wanted to follow-up on this issue. I’m trying to speed up my local builds with the -no-check-ir flag in Motoko, but I do not want this argument to be present in my dfx.json when CI runs, just in case there’s a rare compiler error that arises. The -no-check-ir flag disables some intermediate checks during build that cut my build time by 2/3rds (from 66 seconds to 21 seconds, so I’d really like to use it just during local development, and production deployments as long as CI has passed.
So I can either write a script that edits my dfx.json during CI (yuck), or ideally either have a dynamic way to populate these args or provide a way to target different dfx.json configurations with dfx deploy <canister> --config_file=local.dfx.json or something like that.