Skip to content

Config

config

Handling the configuration for all adapters

DEFAULT_CFG = f'# Configuration for Ultimate Notion## * Non-absolute paths are always relative to the directory of this file.# * You can use environment variables in the format ${env:VAR_NAME} or ${env:VAR_NAME|DEFAULT_VALUE}.[ultimate_notion]sync_state_dir = "sync_states"token = "${env:{ENV_NOTION_TOKEN}}"[google]client_secret_json = "client_secret.json"token_json = "token.json"' module-attribute

DEFAULT_ULTIMATE_NOTION_CFG_PATH: str = '.ultimate-notion/config.toml' module-attribute

Default path within $HOME to the configuration file of Ultimate Notion

ENV_NOTION_TOKEN = 'NOTION_TOKEN' module-attribute

Name of the environment variable to look up the Notion token

ENV_ULTIMATE_NOTION_CFG: str = 'ULTIMATE_NOTION_CONFIG' module-attribute

Name of the environment variable to look up the path for the config

Config

Main configuration object.

google: GoogleCfg | None = None class-attribute instance-attribute

ultimate_notion: UNOCfg instance-attribute

google_convert_path(value: GoogleCfg | None, info: ValidationInfo) -> GoogleCfg | None classmethod

uno_convert_path(value: UNOCfg, info: ValidationInfo) -> UNOCfg classmethod

GoogleCfg

Configuration related to the Google API.

client_secret_json: Path | None = None class-attribute instance-attribute

token_json: Path | None = None class-attribute instance-attribute

UNOCfg

Configuration related to Ultimate Notion itself.

cfg_path: FilePath instance-attribute

sync_state_dir: Path = Path('sync_states') class-attribute instance-attribute

token: str | None = None class-attribute instance-attribute

get_cfg() -> Config

Returns the configuration as an object.

get_cfg_file() -> Path

Determines the path of the config file.

get_or_create_cfg() -> Config

Returns the configuration as an object or creates it if it doesn't exist yet.

resolve_env_value(value: str) -> str

Resolves environment variable values in the format ${env:VAR_NAME|DEFAULT_VALUE}.