Skip to content

Config

config

Handling the configuration for all adapters

DEFAULT_CFG = f'# Configuration for Ultimate Notion\n#\n# * Non-absolute paths are always relative to the directory of this file.\n# * You can use environment variables in the format ${{env:VAR_NAME}} or ${{env:VAR_NAME|DEFAULT_VALUE}}.\n\n[ultimate_notion]\nsync_state_dir = "sync_states"\ndebug = "${{env:{ENV_ULTIMATE_NOTION_DEBUG}|false}}"\ntoken = "${{env:{ENV_NOTION_TOKEN}}}"\n\n[google]\nclient_secret_json = "client_secret.json"\ntoken_json = "token.json"\n' 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

ENV_ULTIMATE_NOTION_DEBUG = 'ULTIMATE_NOTION_DEBUG' module-attribute

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

debug: bool = False class-attribute instance-attribute

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

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

activate_debug_mode() -> None

Activates debug mode by setting up logging and notifying the user.

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}.