use common::config::DatabaseConfig;
use serde::Deserialize;

const DEFAULT_TOML: &str = include_str!("../sdkserver.toml");

#[derive(Deserialize)]
pub struct SdkConfig {
    pub bind_addr: String,
    pub database: DatabaseConfig,
}

pub fn load() -> Option<SdkConfig> {
    match common::config::load_or_create_config("sdkserver.toml", DEFAULT_TOML) {
        Ok(config) => Some(config),
        Err(err) => {
            tracing::error!("Failed to load config: {err}");
            None
        }
    }
}
