config

package
v1.0.15 Latest Latest
Warning

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

Go to latest
Published: May 9, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConfigSchemaVersion = 1
)

Variables

This section is empty.

Functions

func ClearHermesSecret

func ClearHermesSecret(paths Paths) error

func ClearOpenClawToken

func ClearOpenClawToken(paths Paths) error

func ConfigureHermesHostNotify

func ConfigureHermesHostNotify(paths Paths, notifyURL string, secret *string, deliver string, enabled bool) error

func DefaultWorkspaceHomeDir

func DefaultWorkspaceHomeDir(home string) string

func DeriveANPServiceDID

func DeriveANPServiceDID(serviceBaseURL string) string

DeriveANPServiceDID returns the default bare-domain service DID for a service base URL.

func DeriveANPServiceEndpoint

func DeriveANPServiceEndpoint(serviceBaseURL string) string

DeriveANPServiceEndpoint returns the default public ANP RPC endpoint for a service base URL.

func DeriveWebSocketURL

func DeriveWebSocketURL(baseURL string, path string) string

func EnsureConfigSchemaVersion

func EnsureConfigSchemaVersion(path string) error

func JoinBaseURL

func JoinBaseURL(baseURL string, path string) string

func LegacyConfigPath

func LegacyConfigPath(paths Paths) string

func NormalizeBaseURL

func NormalizeBaseURL(baseURL string) string

func NormalizeDIDDomain

func NormalizeDIDDomain(raw string) (string, error)

NormalizeDIDDomain returns a canonical bare-domain did_domain value.

func SetHermesSecret

func SetHermesSecret(paths Paths, secret string) error

func SetOpenClawToken

func SetOpenClawToken(paths Paths, token string) error

func Snapshot

func Snapshot(resolved *Resolved) map[string]any

func UpdateActiveIdentity

func UpdateActiveIdentity(paths Paths, identityName string) error

func UpdateDIDDomain

func UpdateDIDDomain(paths Paths, value string) error

func UpdateHermesSettings

func UpdateHermesSettings(paths Paths, notifyURL *string, deliver *string) error

func UpdateHostNotifyEnabled

func UpdateHostNotifyEnabled(paths Paths, enabled bool) error

func UpdateHostNotifySink

func UpdateHostNotifySink(paths Paths, sink string) error

func UpdateOpenClawSettings

func UpdateOpenClawSettings(paths Paths, hookURL *string) error

func UpdateRuntimeListenerSettings

func UpdateRuntimeListenerSettings(paths Paths, enabled *bool, autoInstall *bool, autoStart *bool) error

func UpdateRuntimeSettings

func UpdateRuntimeSettings(paths Paths, mode string, socketPath string) error

func WriteFileConfig

func WriteFileConfig(path string, fileConfig FileConfig) error

Types

type EnvHit

type EnvHit struct {
	Key    string `json:"key"`
	Value  string `json:"value"`
	Tier   string `json:"tier"`
	Target string `json:"target"`
}

type FileConfig

type FileConfig struct {
	SchemaVersion int `json:"schema_version,omitempty" yaml:"schema_version,omitempty"`
	Identity      struct {
		Active string `json:"active" yaml:"active"`
	} `json:"identity" yaml:"identity"`
	Runtime struct {
		Mode       string `json:"mode" yaml:"mode"`
		SocketPath string `json:"socket_path" yaml:"socket_path"`
		Listener   struct {
			Enabled     *bool `json:"enabled" yaml:"enabled"`
			AutoInstall *bool `json:"auto_install" yaml:"auto_install"`
			AutoStart   *bool `json:"auto_start" yaml:"auto_start"`
		} `json:"listener" yaml:"listener"`
		HostNotify struct {
			Enabled  *bool  `json:"enabled" yaml:"enabled"`
			Sink     string `json:"sink" yaml:"sink"`
			FilePath string `json:"file_path" yaml:"file_path"`
			OpenClaw struct {
				HookURL  string `json:"hook_url" yaml:"hook_url"`
				AgentID  string `json:"agent_id" yaml:"agent_id"`
				HookName string `json:"hook_name" yaml:"hook_name"`
				Token    string `json:"token" yaml:"token"`
			} `json:"openclaw" yaml:"openclaw"`
			Hermes struct {
				NotifyURL string `json:"notify_url" yaml:"notify_url"`
				Deliver   string `json:"deliver" yaml:"deliver"`
				Secret    string `json:"secret" yaml:"secret"`
			} `json:"hermes" yaml:"hermes"`
			LegacyWebhook struct {
				NotifyURL string `json:"notify_url" yaml:"notify_url"`
				Secret    string `json:"secret" yaml:"secret"`
			} `json:"webhook" yaml:"webhook"`
		} `json:"host_notify" yaml:"host_notify"`
	} `json:"runtime" yaml:"runtime"`
	Output struct {
		Format  string `json:"format" yaml:"format"`
		NoColor *bool  `json:"no_color" yaml:"no_color"`
	} `json:"output" yaml:"output"`
	Services struct {
		ServiceBaseURL     string `json:"service_base_url" yaml:"service_base_url"`
		DIDDomain          string `json:"did_domain" yaml:"did_domain"`
		ANPServiceEndpoint string `json:"anp_service_endpoint" yaml:"anp_service_endpoint"`
		ANPServiceDID      string `json:"anp_service_did" yaml:"anp_service_did"`
		CABundle           string `json:"ca_bundle" yaml:"ca_bundle"`
		MailServiceURL     string `json:"mail_service_url,omitempty" yaml:"mail_service_url,omitempty"`
	} `json:"services" yaml:"services"`
	Update struct {
		DisableStrictVersion    bool `json:"disable_strict_version" yaml:"disable_strict_version"`
		MetadataCacheTTLSeconds int  `json:"metadata_cache_ttl_seconds" yaml:"metadata_cache_ttl_seconds"`
	} `json:"update" yaml:"update"`
}

func ReadFileConfig

func ReadFileConfig(path string) (FileConfig, bool, error)

type Overrides

type Overrides struct {
	Identity        string
	IdentityChanged bool
	Format          string
	FormatChanged   bool
}

type Paths

type Paths struct {
	WorkspaceHomeDir     string `json:"workspace_home_dir"`
	RootDir              string `json:"root_dir"`
	ConfigDir            string `json:"config_dir"`
	DataDir              string `json:"data_dir"`
	StateDir             string `json:"state_dir"`
	CacheDir             string `json:"cache_dir"`
	LogsDir              string `json:"logs_dir"`
	ConfigFile           string `json:"config_file"`
	IdentityDir          string `json:"identity_dir"`
	DatabaseFile         string `json:"database_file"`
	LegacyCredentialsDir string `json:"legacy_credentials_dir"`
	LegacyDataDir        string `json:"legacy_data_dir"`
}

type PolicyError

type PolicyError struct {
	Message string
	Hint    string
}

func (*PolicyError) Error

func (e *PolicyError) Error() string

type Resolved

type Resolved struct {
	Paths                         Paths                  `json:"paths"`
	ConfigSchemaVersion           int                    `json:"config_schema_version"`
	ActiveIdentity                string                 `json:"active_identity,omitempty"`
	RuntimeMode                   string                 `json:"runtime_mode"`
	RuntimeSocketPath             string                 `json:"runtime_socket_path,omitempty"`
	RuntimeListenerEnabled        bool                   `json:"runtime_listener_enabled"`
	RuntimeListenerAutoInstall    bool                   `json:"runtime_listener_auto_install"`
	RuntimeListenerAutoStart      bool                   `json:"runtime_listener_auto_start"`
	HostNotifyEnabled             bool                   `json:"host_notify_enabled"`
	HostNotifySink                string                 `json:"host_notify_sink"`
	HostNotifyFilePath            string                 `json:"host_notify_file_path,omitempty"`
	HostNotifyOpenClawHookURL     string                 `json:"host_notify_openclaw_hook_url,omitempty"`
	HostNotifyOpenClawAgentID     string                 `json:"host_notify_openclaw_agent_id,omitempty"`
	HostNotifyOpenClawHookName    string                 `json:"host_notify_openclaw_hook_name,omitempty"`
	HostNotifyHermesNotifyURL     string                 `json:"host_notify_hermes_notify_url,omitempty"`
	HostNotifyHermesDeliver       string                 `json:"host_notify_hermes_deliver,omitempty"`
	OutputFormat                  string                 `json:"output_format"`
	NoColor                       bool                   `json:"no_color"`
	ServiceBaseURL                string                 `json:"service_base_url"`
	DIDDomain                     string                 `json:"did_domain"`
	ANPServiceEndpoint            string                 `json:"anp_service_endpoint"`
	ANPServiceDID                 string                 `json:"anp_service_did"`
	MailServiceURL                string                 `json:"mail_service_url"`
	CABundle                      string                 `json:"ca_bundle,omitempty"`
	UpdateDisableStrictVersion    bool                   `json:"update_disable_strict_version"`
	UpdateMetadataCacheTTLSeconds int                    `json:"update_metadata_cache_ttl_seconds"`
	ConfigExists                  bool                   `json:"config_exists"`
	ConfigError                   string                 `json:"config_error,omitempty"`
	EnvHits                       []EnvHit               `json:"env_hits,omitempty"`
	Sources                       map[string]ValueSource `json:"sources"`
}

func Resolve

func Resolve(overrides Overrides) (*Resolved, error)

type ValueSource

type ValueSource struct {
	Source string `json:"source"`
	Key    string `json:"key,omitempty"`
	Value  string `json:"value,omitempty"`
}

Jump to

Keyboard shortcuts

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