MCPcopy Create free account
hub / github.com/CodSpeedHQ/codspeed / load_config

Function load_config

src/cli/mod.rs:212–232  ·  view source on GitHub ↗

Load the CodSpeed config for this invocation, resolving the active profile (CLI `--profile` / `CODSPEED_PROFILE` / shell-session / built-in `default`) and applying CLI overrides for the OAuth token and api URL. `auth` and `profile` subcommands are allowed to run against a config where the selected profile does not yet exist (e.g. first-time setup).

(cli: &Cli)

Source from the content-addressed store, hash-verified

210/// `auth` and `profile` subcommands are allowed to run against a config
211/// where the selected profile does not yet exist (e.g. first-time setup).
212fn load_config(cli: &Cli) -> Result<CodSpeedConfig> {
213 // The field carries a `#[deprecated]` marker but we still need to
214 // honour it during the deprecation window.
215 #[allow(deprecated)]
216 let config_name = cli.config_name.as_deref();
217 if config_name.is_some() {
218 warn!(
219 "`--config-name` / `CODSPEED_CONFIG_NAME` is deprecated; use `--profile` / `CODSPEED_PROFILE` instead."
220 );
221 }
222 CodSpeedConfig::load_with_profile(
223 config_name,
224 cli.profile.as_deref(),
225 ConfigOverrides {
226 oauth_token: cli.oauth_token.as_deref(),
227 api_url: cli.api_url.as_deref(),
228 upload_url: None,
229 },
230 matches!(&cli.command, Commands::Auth(_) | Commands::Profile(_)),
231 )
232}
233
234/// Build the api client for this invocation, resolving the auth token
235/// from the most specific source available. This is the single source

Callers 1

runFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected