pub fn from_env() -> Self {
        let mut available_block_chunk_sizes = block_chunk_sizes().to_vec();
        available_block_chunk_sizes.sort();

        let max_miniblock_iterations_withdraw_block =
            if env::var("WITHDRAW_BLOCK_MINIBLOCKS_ITERATIONS").is_ok() {
                parse_env("WITHDRAW_BLOCK_MINIBLOCKS_ITERATIONS")
            } else {
                parse_env("MINIBLOCKS_ITERATIONS")
            };

        Self {
            rest_api_server_address: parse_env("REST_API_BIND"),
            json_rpc_http_server_address: parse_env("HTTP_RPC_API_BIND"),
            json_rpc_ws_server_address: parse_env("WS_API_BIND"),
            web3_url: get_env("WEB3_URL"),
            genesis_tx_hash: parse_env_with("GENESIS_TX_HASH", |s| &s[2..]),
            contract_eth_addr: parse_env_with("CONTRACT_ADDR", |s| &s[2..]),
            governance_eth_addr: parse_env_with("GOVERNANCE_ADDR", |s| &s[2..]),
            operator_commit_eth_addr: parse_env_with("OPERATOR_COMMIT_ETH_ADDRESS", |s| &s[2..]),
            operator_fee_eth_addr: parse_env_with("OPERATOR_FEE_ETH_ADDRESS", |s| &s[2..]),
            operator_private_key: if env::var("OPERATOR_PRIVATE_KEY").is_ok() {
                Some(parse_env("OPERATOR_PRIVATE_KEY"))
            } else {
                None
            },
            chain_id: parse_env("CHAIN_ID"),
            gas_price_factor: parse_env("GAS_PRICE_FACTOR"),
            prover_server_address: parse_env("PROVER_SERVER_BIND"),
            confirmations_for_eth_event: parse_env("CONFIRMATIONS_FOR_ETH_EVENT"),
            api_requests_caches_size: parse_env("API_REQUESTS_CACHES_SIZE"),
            available_block_chunk_sizes,
            eth_watch_poll_interval: Duration::from_millis(parse_env::<u64>(
                "ETH_WATCH_POLL_INTERVAL",
            )),
            eth_network: parse_env("ETH_NETWORK"),
            ticker_url: parse_env("TICKER_URL"),
            idle_provers: parse_env("IDLE_PROVERS"),
            max_miniblock_iterations: parse_env("MINIBLOCKS_ITERATIONS"),
            max_miniblock_iterations_withdraw_block,
            prometheus_export_port: parse_env("PROMETHEUS_EXPORT_PORT"),
        }
    }
/// Parses the configuration options values from the environment variables.
/// Panics if any of options is missing or has inappropriate value.
Parses the configuration options values from the environment variables.
Panics if any of options is missing or has inappropriate value.
Parses the configuration options values from the environment variables . Panics if any of options is missing or has inappropriate value .
pub fn from_env() -> Self {
        let mut available_block_chunk_sizes = block_chunk_sizes().to_vec();
        available_block_chunk_sizes.sort();
        let max_miniblock_iterations_withdraw_block =
            if env::var("WITHDRAW_BLOCK_MINIBLOCKS_ITERATIONS").is_ok() {
                parse_env("WITHDRAW_BLOCK_MINIBLOCKS_ITERATIONS")
            } else {
                parse_env("MINIBLOCKS_ITERATIONS")
            };
        Self {
            rest_api_server_address: parse_env("REST_API_BIND"),
            json_rpc_http_server_address: parse_env("HTTP_RPC_API_BIND"),
            json_rpc_ws_server_address: parse_env("WS_API_BIND"),
            web3_url: get_env("WEB3_URL"),
            genesis_tx_hash: parse_env_with("GENESIS_TX_HASH", |s| &s[2..]),
            contract_eth_addr: parse_env_with("CONTRACT_ADDR", |s| &s[2..]),
            governance_eth_addr: parse_env_with("GOVERNANCE_ADDR", |s| &s[2..]),
            operator_commit_eth_addr: parse_env_with("OPERATOR_COMMIT_ETH_ADDRESS", |s| &s[2..]),
            operator_fee_eth_addr: parse_env_with("OPERATOR_FEE_ETH_ADDRESS", |s| &s[2..]),
            operator_private_key: if env::var("OPERATOR_PRIVATE_KEY").is_ok() {
                Some(parse_env("OPERATOR_PRIVATE_KEY"))
            } else {
                None
            },
            chain_id: parse_env("CHAIN_ID"),
            gas_price_factor: parse_env("GAS_PRICE_FACTOR"),
            prover_server_address: parse_env("PROVER_SERVER_BIND"),
            confirmations_for_eth_event: parse_env("CONFIRMATIONS_FOR_ETH_EVENT"),
            api_requests_caches_size: parse_env("API_REQUESTS_CACHES_SIZE"),
            available_block_chunk_sizes,
            eth_watch_poll_interval: Duration::from_millis(parse_env::<u64>(
                "ETH_WATCH_POLL_INTERVAL",
            )),
            eth_network: parse_env("ETH_NETWORK"),
            ticker_url: parse_env("TICKER_URL"),
            idle_provers: parse_env("IDLE_PROVERS"),
            max_miniblock_iterations: parse_env("MINIBLOCKS_ITERATIONS"),
            max_miniblock_iterations_withdraw_block,
            prometheus_export_port: parse_env("PROMETHEUS_EXPORT_PORT"),
        }
    }
pub fn from_env ( ) -> Self { let mut available_block_chunk_sizes = block_chunk_sizes ( ) . to_vec ( ) ; available_block_chunk_sizes . sort ( ) ; let max_miniblock_iterations_withdraw_block = if env :: var ( " " ) . is_ok ( ) { parse_env ( " " ) } else { parse_env ( " " ) } ; Self { rest_api_server_address : parse_env ( " " ) , json_rpc_http_server_address : parse_env ( " " ) , json_rpc_ws_server_address : parse_env ( " " ) , web3_url : get_env ( " " ) , genesis_tx_hash : parse_env_with ( " " , | s | & s [ 2 .. ] ) , contract_eth_addr : parse_env_with ( " " , | s | & s [ 2 .. ] ) , governance_eth_addr : parse_env_with ( " " , | s | & s [ 2 .. ] ) , operator_commit_eth_addr : parse_env_with ( " " , | s | & s [ 2 .. ] ) , operator_fee_eth_addr : parse_env_with ( " " , | s | & s [ 2 .. ] ) , operator_private_key : if env :: var ( " " ) . is_ok ( ) { Some ( parse_env ( " " ) ) } else { None } , chain_id : parse_env ( " " ) , gas_price_factor : parse_env ( " " ) , prover_server_address : parse_env ( " " ) , confirmations_for_eth_event : parse_env ( " " ) , api_requests_caches_size : parse_env ( " " ) , available_block_chunk_sizes , eth_watch_poll_interval : Duration :: from_millis ( parse_env :: < u64 > ( " " , ) ) , eth_network : parse_env ( " " ) , ticker_url : parse_env ( " " ) , idle_provers : parse_env ( " " ) , max_miniblock_iterations : parse_env ( " " ) , max_miniblock_iterations_withdraw_block , prometheus_export_port : parse_env ( " " ) , } }
Parses the configuration options values from the environment variables.
Parses the configuration options values from the environment variables .