Newer
Older
navi-1 / navi / config.py
@Eugene Sukhodolskiy Eugene Sukhodolskiy on 8 Apr 1 KB Unrestricted terminal mode and SSH tool
from pydantic_settings import BaseSettings, SettingsConfigDict


class Settings(BaseSettings):
    model_config = SettingsConfigDict(env_file=".env", env_file_encoding="utf-8", extra="ignore")

    ollama_host: str = "http://localhost:11434"
    ollama_default_model: str = "gemma4:e2b-it-q4_K_M"

    openai_api_key: str = ""
    anthropic_api_key: str = ""

    # Filesystem tool: comma-separated allowed root paths
    fs_allowed_paths: str = "/tmp,/home,/etc,/var,/opt"

    # Terminal tool: "*" = allow all commands (recommended for local use)
    # or comma-separated list of allowed executables, e.g. "ls,cat,git"
    terminal_allowed_commands: str = "*"

    # SSH tool: path to JSON file with named connections
    ssh_hosts_file: str = "ssh_hosts.json"

    log_level: str = "INFO"

    @property
    def fs_allowed_paths_list(self) -> list[str]:
        return [p.strip() for p in self.fs_allowed_paths.split(",") if p.strip()]

    @property
    def terminal_allowed_commands_list(self) -> list[str]:
        return [c.strip() for c in self.terminal_allowed_commands.split(",") if c.strip()]


settings = Settings()