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)
| 275 | /// `auth` and `profile` subcommands are allowed to run against a config |
| 276 | /// where the selected profile does not yet exist (e.g. first-time setup). |
| 277 | fn load_config(cli: &Cli) -> Result<CodSpeedConfig> { |
| 278 | // The field carries a `#[deprecated]` marker but we still need to |
| 279 | // honour it during the deprecation window. |
| 280 | #[allow(deprecated)] |
| 281 | let config_name = cli.config_name.as_deref(); |
| 282 | if config_name.is_some() { |
| 283 | warn!( |
| 284 | "`--config-name` / `CODSPEED_CONFIG_NAME` is deprecated; use `--profile` / `CODSPEED_PROFILE` instead." |
| 285 | ); |
| 286 | } |
| 287 | CodSpeedConfig::load_with_profile( |
| 288 | config_name, |
| 289 | cli.profile.as_deref(), |
| 290 | ConfigOverrides { |
| 291 | oauth_token: cli.oauth_token.as_deref(), |
| 292 | api_url: cli.api_url.as_deref(), |
| 293 | upload_url: None, |
| 294 | }, |
| 295 | matches!(&cli.command, Commands::Auth(_) | Commands::Profile(_)), |
| 296 | ) |
| 297 | } |
| 298 | |
| 299 | /// Build the api client for this invocation, resolving the auth token |
| 300 | /// from the most specific source available. This is the single source |