conf

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConfigName   = "chatlog"
	ConfigType   = "json"
	EnvConfigDir = "CHATLOG_DIR"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	ConfigDir   string          `mapstructure:"-"`
	LastAccount string          `mapstructure:"last_account" json:"last_account"`
	History     []ProcessConfig `mapstructure:"history" json:"history"`
}

func (*Config) ParseHistory

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

func (*Config) UpdateHistory

func (c *Config) UpdateHistory(account string, conf ProcessConfig) error

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"`
	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 Service

type Service struct {
	// contains filtered or unexported fields
}

Service 配置服务

func NewService

func NewService(configPath string) (*Service, error)

NewService 创建配置服务

func (*Service) GetConfig

func (s *Service) GetConfig() *Config

GetConfig 获取配置副本

func (*Service) Load

func (s *Service) Load() error

Load 加载配置

Jump to

Keyboard shortcuts

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