perfgate-config
Configuration loading with three-source priority merge: CLI flags > environment variables > config file.
Overview
perfgate-config resolves the effective perfgate configuration by merging
values from three sources in priority order:
- CLI flags (highest priority)
- Environment variables (
PERFGATE_SERVER_URL,PERFGATE_API_KEY,PERFGATE_PROJECT) - Config file (
perfgate.tomlorperfgate.json)
The merged result is a ResolvedServerConfig that can create ready-to-use
BaselineClient or FallbackClient instances for talking to the centralized
Baseline Service.
Key API
Functions
load_config_file(path)— reads aperfgate.tomlorperfgate.jsonfile and deserializes it into aConfigFile. Returns the default config if the file does not exist.resolve_server_config(flag_url, flag_key, flag_project, file_config)— merges CLI flags with the[baseline_server]section of the config file, producing aResolvedServerConfig.
ResolvedServerConfig
| Method | Description |
|---|---|
is_configured() |
true when a server URL is present |
create_client() |
builds a BaselineClient from the merged settings |
create_fallback_client(dir) |
wraps the client in a FallbackClient that falls back to local storage |
require_fallback_client(dir, msg) |
like above, but returns an error if the server is not configured |
resolve_project(override) |
resolves the project name from the override, config, or returns an error |
Example
use Path;
use ;
let config = load_config_file?;
let resolved = resolve_server_config;
if resolved.is_configured
Workspace Role
perfgate-config bridges configuration sources and the client library:
perfgate-types + perfgate-client -> perfgate-config -> perfgate-app / perfgate-cli
License
Licensed under either Apache-2.0 or MIT.