claw_spawn/infrastructure/
config.rs1use config::{Config, ConfigError, Environment, File};
2use serde::Deserialize;
3
4#[derive(Debug, Deserialize, Clone)]
5pub struct AppConfig {
6 pub database_url: String,
7 pub digitalocean_token: String,
8 pub encryption_key: String,
9 pub server_host: String,
10 pub server_port: u16,
11 pub openclaw_image: String,
12 pub control_plane_url: String,
13
14 pub customizer_repo_url: String,
16 pub customizer_ref: String,
17 pub customizer_workspace_dir: String,
18 pub customizer_agent_name: String,
19 pub customizer_owner_name: String,
20 pub customizer_skip_qmd: bool,
21 pub customizer_skip_cron: bool,
22 pub customizer_skip_git: bool,
23 pub customizer_skip_heartbeat: bool,
24}
25
26impl AppConfig {
27 pub fn from_env() -> Result<Self, ConfigError> {
28 let config = Config::builder()
29 .add_source(File::with_name("config/default").required(false))
30 .add_source(File::with_name("config/local").required(false))
31 .add_source(Environment::with_prefix("CLAW").separator("_"))
32 .set_default("server_host", "0.0.0.0")?
33 .set_default("server_port", 8080)?
34 .set_default("openclaw_image", "ubuntu-22-04-x64")?
35 .set_default("control_plane_url", "https://api.cedros.io")?
36 .set_default(
38 "customizer_repo_url",
39 "https://github.com/janebot2026/janebot-cli.git",
40 )?
41 .set_default("customizer_ref", "4b170b4aa31f79bda84f7383b3992ca8681d06d3")?
42 .set_default("customizer_workspace_dir", "/opt/openclaw/workspace")?
43 .set_default("customizer_agent_name", "Jane")?
44 .set_default("customizer_owner_name", "Cedros")?
45 .set_default("customizer_skip_qmd", true)?
46 .set_default("customizer_skip_cron", true)?
47 .set_default("customizer_skip_git", true)?
48 .set_default("customizer_skip_heartbeat", true)?
49 .build()?;
50
51 config.try_deserialize()
52 }
53}