cdk_mintd/env_vars/
info.rs1use std::env;
4
5use super::common::*;
6use crate::config::Info;
7
8impl Info {
9 pub fn from_env(mut self) -> Self {
10 if let Ok(url) = env::var(ENV_URL) {
12 self.url = url;
13 }
14
15 if let Ok(host) = env::var(ENV_LISTEN_HOST) {
16 self.listen_host = host;
17 }
18
19 if let Ok(port_str) = env::var(ENV_LISTEN_PORT) {
20 if let Ok(port) = port_str.parse() {
21 self.listen_port = port;
22 }
23 }
24
25 if let Ok(mnemonic) = env::var(ENV_MNEMONIC) {
26 self.mnemonic = mnemonic;
27 }
28
29 if let Ok(cache_seconds_str) = env::var(ENV_CACHE_SECONDS) {
30 if let Ok(seconds) = cache_seconds_str.parse() {
31 self.http_cache.ttl = Some(seconds);
32 }
33 }
34
35 if let Ok(extend_cache_str) = env::var(ENV_EXTEND_CACHE_SECONDS) {
36 if let Ok(seconds) = extend_cache_str.parse() {
37 self.http_cache.tti = Some(seconds);
38 }
39 }
40
41 if let Ok(fee_str) = env::var(ENV_INPUT_FEE_PPK) {
42 if let Ok(fee) = fee_str.parse() {
43 self.input_fee_ppk = Some(fee);
44 }
45 }
46
47 if let Ok(swagger_str) = env::var(ENV_ENABLE_SWAGGER) {
48 if let Ok(enable) = swagger_str.parse() {
49 self.enable_swagger_ui = Some(enable);
50 }
51 }
52
53 self.http_cache = self.http_cache.from_env();
54
55 self
56 }
57}