config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultBaseDir = "~/.opagent"
	// System config supports JSONC under ~/.opagent/configs/config.json.
	DefaultDebug                        = false
	DefaultEnv                          = op.EnvLocal
	DefaultMessageStorage               = "markdown"
	DefaultRuntimeUpdateManifestURL     = ""
	DefaultRuntimeUpdateCheckInterval   = "10m"
	DefaultRuntimeUpdateCheckTimeout    = "8s"
	DefaultRuntimeUpdateIdleGracePeriod = "15s"
	DefaultRuntimeUpdateDownloadDir     = "run/runtime-update"
	DefaultMaxThreads                   = 10000
)

Variables

View Source
var (
	// command line flags
	CmdBaseDir = ""
	CmdDebug   = false
	CmdEnv     = op.EnvLocal
)

Functions

func ApplyRuntimeDefaults

func ApplyRuntimeDefaults(baseDir string)

ApplyRuntimeDefaults resolves storage paths after either the built-in loader or a host ConfigLoader has populated the process configuration.

func GetConfig

func GetConfig() *op.Config

func GetHostName

func GetHostName() string

func GetIps

func GetIps() []string

func GetModelConfig

func GetModelConfig(modelKey string) (*op.ModelConfig, error)

func GetSecrets

func GetSecrets() map[string]string

func GetSystem

func GetSystem() *op.SystemConfig

func GetUserConfig

func GetUserConfig() *op.UserConfig

func GetUserProfile

func GetUserProfile() *op.UserProfile

func LoadLocalUserProfile

func LoadLocalUserProfile() (*op.UserProfile, error)

func NormalizeServiceTier

func NormalizeServiceTier(value string) string

func Parse

func Parse(configDir string) error

func ReloadLocalUserConfig

func ReloadLocalUserConfig() (*op.UserProfile, error)

func SetConfig

func SetConfig(next *op.Config) error

func SetSecrets

func SetSecrets(values map[string]string)

func SetSystem

func SetSystem(c *op.SystemConfig)

func SetUserProfile

func SetUserProfile(c *op.UserProfile)

func StartUserConfigWatcher

func StartUserConfigWatcher(ctx context.Context, onReload func(changedPath string)) error

StartUserConfigWatcher watches baseDir/configs/user and hot-reloads local user config files.

func SyncModelCache

func SyncModelCache(models []op.ModelConfig)

Types

type HostInfoConfig

type HostInfoConfig struct {
	HostID   string
	HostName string
	Ips      []string
}

func GetHostInfo

func GetHostInfo(sysDir string) *HostInfoConfig

GetHostInfo returns host info using sysDir for host_id persistence. Use this when building system config before SetSystem has been called.

Jump to

Keyboard shortcuts

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