notion_cli_rs/
config.rs

1use anyhow::{anyhow, Result};
2use std::env;
3
4#[allow(dead_code)]
5#[derive(Debug)]
6pub struct Config {
7    pub notion_token: String,
8    pub database_id: String,
9}
10
11#[allow(dead_code)]
12impl Config {
13    pub fn new() -> Result<Self> {
14        let notion_token = env::var("NOTION_TOKEN")
15            .map_err(|_| anyhow!("NOTION_TOKEN environment variable not set"))?;
16        let database_id = env::var("NOTION_DATABASE_ID")
17            .map_err(|_| anyhow!("NOTION_DATABASE_ID environment variable not set"))?;
18
19        Ok(Config {
20            notion_token,
21            database_id,
22        })
23    }
24}