canic_core/interface/ic/network.rs
1///
2/// Network
3/// Identifies the environment the canister believes it runs in.
4///
5pub enum Network {
6 Ic,
7 Local,
8}
9
10///
11/// get_network
12/// Determine the current network from `DFX_NETWORK`.
13///
14#[must_use]
15pub fn get_network() -> Option<Network> {
16 match option_env!("DFX_NETWORK") {
17 Some("local") => Some(Network::Local),
18 Some("ic") => Some(Network::Ic),
19
20 _ => None,
21 }
22}