conf

package
v0.0.29 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AppName          = "chatlog"
	ServerConfigName = "chatlog-server"
	EnvPrefix        = "CHATLOG"
	EnvConfigDir     = "CHATLOG_DIR"
)
View Source
const (
	DefalutHTTPAddr = "0.0.0.0:5030"
)

Variables

View Source
var DataDirConfigs = map[string]bool{
	"type":         true,
	"platform":     true,
	"version":      true,
	"full_version": true,
	"data_key":     true,
	"img_key":      true,
}
View Source
var ServerDefaults = map[string]any{}
View Source
var TUIDefaults = map[string]any{}

Functions

This section is empty.

Types

type File

type File struct {
	Path         string `mapstructure:"path" json:"path"`
	ModifiedTime int64  `mapstructure:"modified_time" json:"modified_time"`
	Size         int64  `mapstructure:"size" json:"size"`
}

type ProcessConfig

type ProcessConfig struct {
	Type        string `mapstructure:"type" json:"type"`
	Account     string `mapstructure:"account" json:"account"`
	Platform    string `mapstructure:"platform" json:"platform"`
	Version     int    `mapstructure:"version" json:"version"`
	FullVersion string `mapstructure:"full_version" json:"full_version"`
	DataDir     string `mapstructure:"data_dir" json:"data_dir"`
	DataKey     string `mapstructure:"data_key" json:"data_key"`
	ImgKey      string `mapstructure:"img_key" json:"img_key"`
	WorkDir     string `mapstructure:"work_dir" json:"work_dir"`
	HTTPEnabled bool   `mapstructure:"http_enabled" json:"http_enabled"`
	HTTPAddr    string `mapstructure:"http_addr" json:"http_addr"`
	LastTime    int64  `mapstructure:"last_time" json:"last_time"`
	Files       []File `mapstructure:"files" json:"files"`
}

type ServerConfig added in v0.0.20

type ServerConfig struct {
	Type        string   `mapstructure:"type"`
	Platform    string   `mapstructure:"platform"`
	Version     int      `mapstructure:"version"`
	FullVersion string   `mapstructure:"full_version"`
	DataDir     string   `mapstructure:"data_dir"`
	DataKey     string   `mapstructure:"data_key"`
	ImgKey      string   `mapstructure:"img_key"`
	WorkDir     string   `mapstructure:"work_dir"`
	HTTPAddr    string   `mapstructure:"http_addr"`
	AutoDecrypt bool     `mapstructure:"auto_decrypt"`
	Webhook     *Webhook `mapstructure:"webhook"`
}

func LoadServiceConfig added in v0.0.20

func LoadServiceConfig(configPath string, cmdConf map[string]any) (*ServerConfig, *config.Manager, error)

LoadServiceConfig 加载服务配置

func (*ServerConfig) GetAutoDecrypt added in v0.0.20

func (c *ServerConfig) GetAutoDecrypt() bool

func (*ServerConfig) GetDataDir added in v0.0.20

func (c *ServerConfig) GetDataDir() string

func (*ServerConfig) GetDataKey added in v0.0.20

func (c *ServerConfig) GetDataKey() string

func (*ServerConfig) GetHTTPAddr added in v0.0.20

func (c *ServerConfig) GetHTTPAddr() string

func (*ServerConfig) GetImgKey added in v0.0.20

func (c *ServerConfig) GetImgKey() string

func (*ServerConfig) GetPlatform added in v0.0.20

func (c *ServerConfig) GetPlatform() string

func (*ServerConfig) GetVersion added in v0.0.20

func (c *ServerConfig) GetVersion() int

func (*ServerConfig) GetWebhook added in v0.0.25

func (c *ServerConfig) GetWebhook() *Webhook

func (*ServerConfig) GetWorkDir added in v0.0.20

func (c *ServerConfig) GetWorkDir() string

type TUIConfig added in v0.0.20

type TUIConfig struct {
	ConfigDir   string          `mapstructure:"-" json:"config_dir"`
	LastAccount string          `mapstructure:"last_account" json:"last_account"`
	History     []ProcessConfig `mapstructure:"history" json:"history"`
	Webhook     *Webhook        `mapstructure:"webhook" json:"webhook"`
}

func LoadTUIConfig added in v0.0.20

func LoadTUIConfig(configPath string) (*TUIConfig, *config.Manager, error)

LoadTUIConfig 加载 TUI 配置

func (*TUIConfig) ParseHistory added in v0.0.20

func (c *TUIConfig) ParseHistory() map[string]ProcessConfig

type Webhook added in v0.0.25

type Webhook struct {
	Host    string         `mapstructure:"host"`
	DelayMs int64          `mapstructure:"delay_ms"`
	Items   []*WebhookItem `mapstructure:"items"`
}

type WebhookItem added in v0.0.25

type WebhookItem struct {
	Type     string `mapstructure:"type"`
	URL      string `mapstructure:"url"`
	Talker   string `mapstructure:"talker"`
	Sender   string `mapstructure:"sender"`
	Keyword  string `mapstructure:"keyword"`
	Disabled bool   `mapstructure:"disabled"`
}

Jump to

Keyboard shortcuts

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