config

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetConfigPath

func GetConfigPath() (string, error)

GetConfigPath returns the default config file path

Types

type Config

type Config struct {
	Port         int           `json:"port"`
	Endpoints    []Endpoint    `json:"endpoints"`
	LogLevel     int           `json:"logLevel"`         // 0=DEBUG, 1=INFO, 2=WARN, 3=ERROR
	Language     string        `json:"language"`         // UI language: en, zh-CN
	WindowWidth  int           `json:"windowWidth"`      // Window width in pixels
	WindowHeight int           `json:"windowHeight"`     // Window height in pixels
	WebDAV       *WebDAVConfig `json:"webdav,omitempty"` // WebDAV synchronization config
	// contains filtered or unexported fields
}

Config represents the application configuration

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns a default configuration

func Load

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

Load loads configuration from file

func (*Config) GetEndpoints

func (c *Config) GetEndpoints() []Endpoint

GetEndpoints returns a copy of endpoints (thread-safe)

func (*Config) GetLanguage added in v0.8.0

func (c *Config) GetLanguage() string

GetLanguage returns the configured language (thread-safe)

func (*Config) GetLogLevel added in v0.4.0

func (c *Config) GetLogLevel() int

GetLogLevel returns the configured log level (thread-safe)

func (*Config) GetPort

func (c *Config) GetPort() int

GetPort returns the configured port (thread-safe)

func (*Config) GetWebDAV added in v1.3.0

func (c *Config) GetWebDAV() *WebDAVConfig

GetWebDAV returns the WebDAV configuration (thread-safe)

func (*Config) GetWindowSize added in v1.1.2

func (c *Config) GetWindowSize() (width, height int)

GetWindowSize returns the configured window size (thread-safe)

func (*Config) Save

func (c *Config) Save(path string) error

Save saves configuration to file

func (*Config) UpdateEndpoints

func (c *Config) UpdateEndpoints(endpoints []Endpoint)

UpdateEndpoints updates the endpoints (thread-safe)

func (*Config) UpdateLanguage added in v0.8.0

func (c *Config) UpdateLanguage(language string)

UpdateLanguage updates the language (thread-safe)

func (*Config) UpdateLogLevel added in v0.4.0

func (c *Config) UpdateLogLevel(level int)

UpdateLogLevel updates the log level (thread-safe)

func (*Config) UpdatePort

func (c *Config) UpdatePort(port int)

UpdatePort updates the port (thread-safe)

func (*Config) UpdateWebDAV added in v1.3.0

func (c *Config) UpdateWebDAV(webdav *WebDAVConfig)

UpdateWebDAV updates the WebDAV configuration (thread-safe)

func (*Config) UpdateWindowSize added in v1.1.2

func (c *Config) UpdateWindowSize(width, height int)

UpdateWindowSize updates the window size (thread-safe)

func (*Config) Validate

func (c *Config) Validate() error

Validate checks if the configuration is valid

type Endpoint

type Endpoint struct {
	Name        string `json:"name"`
	APIUrl      string `json:"apiUrl"`
	APIKey      string `json:"apiKey"`
	Enabled     bool   `json:"enabled"`
	Transformer string `json:"transformer,omitempty"` // Transformer type: claude, openai, gemini, deepseek
	Model       string `json:"model,omitempty"`       // Target model name for non-Claude APIs
	Remark      string `json:"remark,omitempty"`      // Optional remark for the endpoint
}

Endpoint represents a single API endpoint configuration

type WebDAVConfig added in v1.3.0

type WebDAVConfig struct {
	URL        string `json:"url"`        // WebDAV server URL
	Username   string `json:"username"`   // Username
	Password   string `json:"password"`   // Password
	ConfigPath string `json:"configPath"` // Config backup path (default /ccNexus/config)
	StatsPath  string `json:"statsPath"`  // Stats backup path (default /ccNexus/stats)
}

WebDAVConfig represents WebDAV synchronization configuration

Jump to

Keyboard shortcuts

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