Public Access
feat: initial source commit
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
use serde::Deserialize;
|
||||
use std::fs;
|
||||
|
||||
#[derive(Debug, Deserialize, Clone)]
|
||||
pub struct Config {
|
||||
pub database_path: String,
|
||||
pub bind: String,
|
||||
pub notification_webhook: Option<String>,
|
||||
pub notification_webhook_token: Option<String>,
|
||||
pub base_url: String,
|
||||
}
|
||||
|
||||
impl Default for Config {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
database_path: "/home/node/.openclaw/workspace/config/action-gateway.db".into(),
|
||||
bind: "0.0.0.0:7878".into(),
|
||||
notification_webhook: None,
|
||||
notification_webhook_token: None,
|
||||
base_url: "http://localhost:7878".into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Config {
|
||||
pub fn load() -> Self {
|
||||
// Check multiple locations in order
|
||||
let paths = [
|
||||
std::env::var("GATEWAY_CONFIG").unwrap_or_default(),
|
||||
"/srv/action-gateway/action-gateway.toml".into(),
|
||||
"/home/node/.openclaw/workspace/config/action-gateway.toml".into(),
|
||||
];
|
||||
for path in &paths {
|
||||
if path.is_empty() { continue; }
|
||||
if let Ok(contents) = fs::read_to_string(path) {
|
||||
return toml::from_str(&contents).unwrap_or_default();
|
||||
}
|
||||
}
|
||||
Config::default()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user