config

package
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 15, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package config loads and validates the server's environment-variable configuration. There is no config file and no flag-driven config — the only flags on the binary are operational (--version, --dump-schemas, --skip-probe). Everything else is env.

Validation runs once at process start. A missing or malformed required variable produces a clear error and the caller (cmd/pipedrive-mcp/main.go) exits non-zero before announcing the MCP server, so an LLM client never sees a half-initialized server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateDomain

func ValidateDomain(s string) (string, error)

ValidateDomain normalizes (trim, lowercase) and validates a Pipedrive workspace subdomain. Shared between Load and the login/logout subcommands so all entry points apply the same regex.

Types

type Config

type Config struct {
	CompanyDomain     string
	LogLevel          LogLevel
	LogFormat         LogFormat
	EnableDestructive bool
	DryRun            bool
	HTTPTimeout       time.Duration
}

Config is the validated runtime configuration. The API token is resolved separately by the credentials package — it is not part of Config so the env-var lookup logic doesn't fight with the keyring.

func Load

func Load() (Config, error)

Load reads configuration from the process environment and validates it. PIPEDRIVE_COMPANY_DOMAIN is required; for callers that resolve the domain themselves (e.g., from a userconfig file fallback), use LoadFor.

func LoadFor

func LoadFor(rawDomain string) (Config, error)

LoadFor reads configuration with a pre-resolved company domain. The domain is validated through ValidateDomain; an empty or malformed value returns an error. All other config still comes from the environment.

type LogFormat

type LogFormat string

LogFormat is a typed enum constrained at config-load time.

const (
	LogText LogFormat = "text"
	LogJSON LogFormat = "json"
)

Allowed LogFormat values. Anything else fails Load.

type LogLevel

type LogLevel string

LogLevel is a typed enum constrained at config-load time.

const (
	LogDebug LogLevel = "debug"
	LogInfo  LogLevel = "info"
	LogWarn  LogLevel = "warn"
	LogError LogLevel = "error"
)

Allowed LogLevel values. Anything else fails Load.

func (LogLevel) Slog

func (l LogLevel) Slog() slog.Level

Slog returns the slog.Level corresponding to this log level.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL