// daemon_config.el — Daemon configuration (filesystem / env-based). // // Handles runtime config loaded from ~/.neuron/config.json or the // NEURON_CONFIG env var. Distinct from config.el, which is the Neuron // tool API for runtime key/value config entries. fn config_path() -> String { let override_path: String = env("NEURON_CONFIG") if !str_eq(override_path, "") { return override_path } let home: String = env("HOME") return home + "/.neuron/config.json" } fn load_config() -> String { let path: String = config_path() let raw: String = fs_read(path) if str_eq(raw, "") { return "{}" } return raw } fn config_api_url(cfg: String) -> String { let url: String = json_get(cfg, "axon_url") if !str_eq(url, "") { return url } let url2: String = json_get(cfg, "api_url") if !str_eq(url2, "") { return url2 } return "http://localhost:7770" } fn config_api_token(cfg: String) -> String { return json_get(cfg, "api_token") } fn config_ui_dir(cfg: String) -> String { let home: String = env("HOME") let dir: String = json_get(cfg, "ui_dir") if str_eq(dir, "") { return home + "/.neuron/ui" } return dir } fn config_data_dir(cfg: String) -> String { let dir: String = json_get(cfg, "data_dir") if !str_eq(dir, "") { return dir } let home: String = env("HOME") return home + "/.neuron/data" } fn config_port(cfg: String) -> Int { let p: String = json_get(cfg, "port") if str_eq(p, "") { return 7749 } return str_to_int(p) } // Principal identity is NOT read from config — it is baked into the compiled // binary at build time. See main.el (developer) and main-user.el (user build). // config_mode() has been removed. Use daemon_principal() from the entry file.