Skip to main content

build_source

Function build_source 

Source
pub async fn build_source(
    system: &SystemConfig,
    seed_path: &Path,
) -> Result<(Arc<dyn ConfigStore>, GatewayConfig, Option<PathBuf>), String>
Expand description

Builds the etcd store and the initial gateway config.

Seeds etcd from the local gateway.yaml (seed_path) when the etcd prefix is empty, then loads from etcd. Returns config_path = None (etcd mode does not reload from disk).

The seed candidate is dry-run compiled before anything is written (see crate::state::validate_gateway_config). A local config that does not compile is logged and skipped, leaving the prefix empty: startup then proceeds with no routes, and the next boot re-seeds once the file is fixed. Writing it anyway would publish a config the whole cluster then fails to apply — and, because the prefix would no longer be empty, no later boot would ever re-seed it.