config

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: May 31, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package config loads shim configuration from a .env file and the process environment. Zero external dependencies.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultEnvPath added in v1.0.0

func DefaultEnvPath() string

DefaultEnvPath resolves which .env file to load, in order: SHIM_ENV_FILE (explicit override), ./.env (working directory — the dev workflow), then <user-config>/shim/.env (so a background service started by `brew services` finds its config regardless of working directory). Returns "" when none exists; Load then runs from the process environment alone.

<user-config> is $XDG_CONFIG_HOME or ~/.config — i.e. ~/.config/shim/.env.

Types

type Config

type Config struct {
	BindAddr        string
	Port            int
	Adapter         string
	UpstreamAPIKey  string
	UpstreamBaseURL string
	UpstreamModel   string // optional; catch-all for non-claude-* inputs
	// Per-role overrides — empty means "use adapter default for this role."
	// Claude Code sends claude-opus*/sonnet*/haiku* model names; the adapter
	// maps those to upstream-specific models. These env vars override the
	// adapter's per-role default.
	UpstreamOpusModel   string
	UpstreamSonnetModel string
	UpstreamHaikuModel  string
	LogLevel            string
	LogRedact           bool
	MaxRequestBytes     int64
}

Config holds runtime configuration. Fields are populated from the process environment, optionally pre-seeded from a .env file.

func Load

func Load(envPath string) (*Config, error)

Load reads a .env file (if present) into the process environment, then constructs a Config. Existing process env always wins over .env entries.

Jump to

Keyboard shortcuts

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