MCPcopy Create free account
hub / github.com/Dstack-TEE/dstack / load_config

Function load_config

certbot/cli/src/main.rs:122–146  ·  view source on GitHub ↗
(config: &PathBuf)

Source from the content-addressed store, hash-verified

120}
121
122fn load_config(config: &PathBuf) -> Result<CertBotConfig> {
123 let config: Config = toml_edit::de::from_str(&fs::read_to_string(config)?)?;
124 let workdir = WorkDir::new(&config.workdir);
125 let renew_interval = Duration::from_secs(config.renew_interval);
126 let renew_expires_in = Duration::from_secs(config.renew_days_before * 24 * 60 * 60);
127 let renew_timeout = Duration::from_secs(config.renew_timeout);
128 let max_dns_wait = Duration::from_secs(config.max_dns_wait);
129 let bot_config = CertBotConfig::builder()
130 .acme_url(config.acme_url)
131 .cert_dir(workdir.backup_dir())
132 .cert_file(workdir.cert_path())
133 .key_file(workdir.key_path())
134 .auto_create_account(true)
135 .cert_subject_alt_names(config.domains)
136 .cf_api_token(config.cf_api_token)
137 .renew_interval(renew_interval)
138 .renew_timeout(renew_timeout)
139 .renew_expires_in(renew_expires_in)
140 .max_dns_wait(max_dns_wait)
141 .credentials_file(workdir.account_credentials_path())
142 .auto_set_caa(config.auto_set_caa)
143 .maybe_renewed_hook(config.renewed_hook)
144 .build();
145 Ok(bot_config)
146}
147
148async fn renew(config: &PathBuf, once: bool, force: bool) -> Result<()> {
149 let bot_config = load_config(config).context("Failed to load configuration")?;

Callers 2

renewFunction · 0.70
mainFunction · 0.70

Calls 6

renew_intervalMethod · 0.80
backup_dirMethod · 0.80
cert_pathMethod · 0.80
key_pathMethod · 0.80
buildMethod · 0.45

Tested by

no test coverage detected