Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

976 B
Raw Blame
use anyhow::Context;
use macro_auth::InternalApiKey;
pub use macro_env::Environment;
use macro_env_var::env_vars;

env_vars! {
    pub struct StaticFileServiceDynamodbTableName;
    pub struct StaticStorageBucket;
}

#[derive(macro_config::MacroConfig)]
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
pub struct Config {
    /// self explanatory
    #[macro_config_default(Environment::new_or_prod())]
    pub environment: Environment,
    /// port (8080)
    #[macro_config_default(8080)]
    pub port: usize,
    /// the tablename of the metadata table
    pub static_file_service_dynamodb_table_name: StaticFileServiceDynamodbTableName,
    /// s3 storage bucket
    pub static_storage_bucket: StaticStorageBucket,
    /// Internal API key
    pub internal_api_key: InternalApiKey,
}

impl Config {
    pub fn from_env() -> anyhow::Result<Self> {
        macro_config::ConfigLoader::load::<Config>()
            .context("failed to load static file service config")
    }
}