Reputation: 18993
I'm trying to find out if it is possible to use configurable-env
Cargo feature to set environment variables specific to a certain profile.
# Instead of global version:
# [env]
# FOO_QTY = "10"
# Something similar to the following(pseudocode):
[profile.test.env]
FOO_QTY = "2"
[profile.release.env]
FOO_QTY = "1000"
Upvotes: 3
Views: 950
Reputation: 8951
Not exactly your question, but you can create a static
or const
that's set based on the profile.
pub const FOO_QTY: usize = if cfg!(build = "release") {
1000
} else {
2
};
Presumably you're trying to conditionally configure some value or behavior (at least that's how I found this question). The cfg!
macro is a more flexible way to do that.
Upvotes: 1