config

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultTimeoutMS      = 20_000
	DefaultModel          = string(anthropic.ModelClaudeHaiku4_5)
	DefaultProvider       = "anthropic"
	DefaultLogMaxSize     = 5 * 1024 * 1024 // 5MB
	DefaultMetricsMaxSize = 2 * 1024 * 1024 // 2MB
	BaseConfigName        = "ccgate.jsonnet"
	LocalConfigName       = "ccgate.local.jsonnet"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Provider        ProviderConfig `json:"provider"`
	LogPath         string         `json:"log_path"`
	LogDisabled     *bool          `json:"log_disabled"`
	LogMaxSize      *int64         `json:"log_max_size"`
	MetricsPath     string         `json:"metrics_path"`
	MetricsDisabled *bool          `json:"metrics_disabled"`
	MetricsMaxSize  *int64         `json:"metrics_max_size"`
	Allow           []string       `json:"allow"`
	Deny            []string       `json:"deny"`
	Environment     []string       `json:"environment"`
}

func Default

func Default() Config

func Load

func Load(cwd string) (Config, error)

Load reads the base config from ~/.claude/ and merges project-local overrides.

func (Config) GetLogMaxSize added in v0.3.0

func (c Config) GetLogMaxSize() int64

GetLogMaxSize returns the log max size, defaulting to DefaultLogMaxSize. 0 means no rotation.

func (Config) GetMetricsMaxSize added in v0.3.0

func (c Config) GetMetricsMaxSize() int64

GetMetricsMaxSize returns the metrics max size, defaulting to DefaultMetricsMaxSize. 0 means no rotation.

func (Config) GetTimeoutMS added in v0.3.0

func (c Config) GetTimeoutMS() int

GetTimeoutMS returns the provider timeout in milliseconds. nil defaults to DefaultTimeoutMS.

func (Config) IsLogDisabled added in v0.3.0

func (c Config) IsLogDisabled() bool

IsLogDisabled returns whether logging is disabled.

func (Config) IsMetricsDisabled added in v0.3.0

func (c Config) IsMetricsDisabled() bool

IsMetricsDisabled returns whether metrics collection is disabled.

func (Config) ResolveLogPath

func (c Config) ResolveLogPath() string

ResolveLogPath returns the resolved log file path.

func (Config) ResolveMetricsPath added in v0.3.0

func (c Config) ResolveMetricsPath() string

ResolveMetricsPath returns the resolved metrics file path.

func (Config) Validate

func (c Config) Validate() error

Validate checks Config invariants. Returns an error describing all violations.

type ProviderConfig

type ProviderConfig struct {
	Name      string `json:"name"`
	Model     string `json:"model"`
	TimeoutMS *int   `json:"timeout_ms"`
}

func (ProviderConfig) GetTimeoutMS added in v0.3.0

func (p ProviderConfig) GetTimeoutMS() int

GetTimeoutMS returns the timeout in milliseconds. nil defaults to DefaultTimeoutMS; 0 means no timeout.

Jump to

Keyboard shortcuts

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