Inspect environment variables at compile time.
In your Scarb.toml
:
[dependencies]
env_macro = "0.1.0"
In your code:
const VERSION: usize = env!("VERSION");
- Specify a default value if the environment variable is not set:
const VERSION: usize = env!("VERSION", 1);
- Only numeric values are supported at the moment.