coreason-runtime 0.1.0

Kinetic Plane execution engine for the CoReason Tripartite Cybernetic Manifold
Documentation
// Copyright (c) 2026 CoReason, Inc.
// All rights reserved.

use std::env;

#[derive(Clone, Debug)]
pub struct Config {
    pub port: u16,
    pub python_sidecar: String,
    pub lancedb_uri: String,
    pub plugins_dir: String,
    pub telemetry_broker_url: String,
    pub temporal_host: String,
    pub master_gateway_url: String,
}

impl Config {
    pub fn from_env() -> Self {
        let port = env::var("PORT")
            .ok()
            .and_then(|p| p.parse().ok())
            .unwrap_or(8080);

        let python_sidecar =
            env::var("PYTHON_SIDECAR_URL").unwrap_or_else(|_| "http://127.0.0.1:8000".to_string());

        let lancedb_uri =
            env::var("LANCEDB_URI").unwrap_or_else(|_| "/app/data/lancedb".to_string());

        let plugins_dir =
            env::var("PLUGINS_DIR").unwrap_or_else(|_| "/app/data/plugins".to_string());

        let telemetry_broker_url = env::var("TELEMETRY_BROKER_URL")
            .unwrap_or_else(|_| "http://localhost:8000".to_string());

        let temporal_host =
            env::var("TEMPORAL_HOST").unwrap_or_else(|_| "temporal:7233".to_string());

        let master_gateway_url = env::var("COREASON_MASTER_GATEWAY_URL")
            .unwrap_or_else(|_| "http://host.docker.internal:8080".to_string());

        Self {
            port,
            python_sidecar,
            lancedb_uri,
            plugins_dir,
            telemetry_broker_url,
            temporal_host,
            master_gateway_url,
        }
    }
}