Source code for nordigen_cli.settings

from pathlib import Path

import typer
from fast_api.config import FormatChoices
from pydantic import (
    Field,
)
from pydantic_settings import BaseSettings
from nordigen_cli import __app_name__

# import pprint


[docs] class SettingsConfig(BaseSettings): """ represents values that need to be available to determine the settings from various path and profile options that must be set up front """ config_file: Path = Field( default=Path(typer.get_app_dir(__app_name__)) / "config.json" ) config_dir: Path = Field(default=Path(typer.get_app_dir(__app_name__))) profile: str = "default"
[docs] class SettingsDisplay(BaseSettings): """ display settings that are used to determine how the output is displayed """ verbose: int = 1 output_format: FormatChoices = FormatChoices.RICH
[docs] class SettingsRuntime(BaseSettings): api: str secret_id: str secret_key: str access_token_file: Path = Field( default=Path(typer.get_app_dir(__app_name__)) / "access.json" ) request_token_file: Path = Field( default=Path(typer.get_app_dir(__app_name__)) / SettingsConfig.model_fields["profile"].default / "request.json" ) verbose: int = 1 output_format: FormatChoices = FormatChoices.RICH
# model_config = SettingsConfigDict( # env_file_encoding="utf-8", # env_prefix="NORDIGEN_", # validate_default=False, # )