config

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: MIT Imports: 17 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const CurrentVersion = 1

Variables

This section is empty.

Functions

func NormalizeProfileURL

func NormalizeProfileURL(value string) (string, error)

func ValidateMCPToken added in v0.2.0

func ValidateMCPToken(value string) error

Types

type Alias

type Alias struct {
	Asset        string `toml:"asset"`
	Account      string `toml:"account,omitempty"`
	Organization string `toml:"organization,omitempty"`
}

type Behavior

type Behavior struct {
	RefreshCheckInterval Duration `toml:"refresh_check_interval"`
	RefreshBeforeExpiry  Duration `toml:"refresh_before_expiry"`
	ConnectTimeout       Duration `toml:"connect_timeout"`
	OAuthTimeout         Duration `toml:"oauth_timeout"`
}

type Config

type Config struct {
	Version        int                `toml:"version"`
	CurrentProfile string             `toml:"current_profile"`
	Behavior       Behavior           `toml:"behavior"`
	Profiles       map[string]Profile `toml:"profiles"`
	MCP            *MCP               `toml:"mcp,omitempty"`
}

func Decode

func Decode(data []byte) (Config, error)

func Default

func Default() Config

func (Config) MCPSettings added in v0.2.0

func (c Config) MCPSettings() MCP

func (*Config) Validate

func (c *Config) Validate() error

type Duration

type Duration struct {
	time.Duration
}

func (Duration) MarshalText

func (d Duration) MarshalText() ([]byte, error)

func (*Duration) UnmarshalText

func (d *Duration) UnmarshalText(text []byte) error

type MCP added in v0.2.0

type MCP struct {
	ListenHost string `toml:"listen_host" json:"listenHost"`
	Port       int    `toml:"port" json:"port"`
	AllowLAN   bool   `toml:"allow_lan" json:"allowLAN"`
	TLSCert    string `toml:"tls_cert,omitempty" json:"tlsCert"`
	TLSKey     string `toml:"tls_key,omitempty" json:"tlsKey"`
	Token      string `toml:"token,omitempty" json:"token,omitempty"`
}

MCP 保存共享设置与访问 Token;是否运行由宿主显式控制。

func DefaultMCP added in v0.2.0

func DefaultMCP() MCP

func (MCP) Address added in v0.2.0

func (m MCP) Address() string

func (MCP) URL added in v0.2.0

func (m MCP) URL() string

func (MCP) Validate added in v0.2.0

func (m MCP) Validate() error

func (MCP) WithoutToken added in v0.2.0

func (m MCP) WithoutToken() MCP

WithoutToken 用于实例描述等不应保存或返回访问凭据的场景。

type Profile

type Profile struct {
	URL          string           `toml:"url"`
	Organization string           `toml:"organization,omitempty"`
	Aliases      map[string]Alias `toml:"aliases,omitempty"`
}

type Store

type Store struct {
	Path string
}

func (Store) Load

func (s Store) Load() (Config, error)

func (Store) Save

func (s Store) Save(value Config) (err error)

func (Store) Update

func (s Store) Update(ctx context.Context, change func(*Config) error) (err error)

Jump to

Keyboard shortcuts

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