conf

package
v0.0.0-...-8fdaee9 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2022 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetConfigFile

func GetConfigFile() string

GetConfigFile

@Description:

* @return string

func GetVersion

func GetVersion() string

GetVersion

@Description: 获取应用程序版本号
* @return string

func InitConfig

func InitConfig(path string, restart func())

InitConfig

@Description: 初始化配置文件
* @param path

func SaveConfigFile

func SaveConfigFile(data string) error

func SetConfig

func SetConfig(config2 Config) error

func SetVersion

func SetVersion(string2 string)

SetVersion

@Description: 设置应用程序版本号
* @param string2

Types

type Config

type Config struct {
	Model       int    `json:"model" yaml:"model" mapstructure:"model"`
	LogLevel    string `json:"log_level" yaml:"log_level" mapstructure:"log_level"`
	ShowBrowser bool   `json:"show_browser" yaml:"show_browser" mapstructure:"show_browser"`
	Scheme      string `json:"scheme" yaml:"scheme" mapstructure:"scheme"`
	Push        struct {
		Ding struct {
			Enable      bool   `json:"enable" yaml:"enable" mapstructure:"enable"`
			AccessToken string `json:"access_token" yaml:"access_token" mapstructure:"access_token"`
			Secret      string `json:"secret" yaml:"secret" mapstructure:"secret"`
		} `json:"ding" yaml:"ding" mapstructure:"ding"`
		PushPlus struct {
			Enable bool   `json:"enable" yaml:"enable" mapstructure:"enable"`
			Token  string `json:"token" yaml:"token" mapstructure:"token"`
			Topic  string `json:"topic" yaml:"topic" mapstructure:"topic"`
		} `json:"push_plus" yaml:"push_plus" mapstructure:"push_plus"`
	} `json:"push" yaml:"push" mapstructure:"push"`
	TG struct {
		Enable    bool    `json:"enable" yaml:"enable" mapstructure:"enable"`
		Token     string  `json:"token" yaml:"token" mapstructure:"token"`
		ChatID    int64   `json:"chat_id" yaml:"chat_id" mapstructure:"chat_id"`
		Proxy     string  `json:"proxy" yaml:"proxy" mapstructure:"proxy"`
		CustomApi string  `json:"custom_api" yaml:"custom_api" mapstructure:"custom_api"`
		WhiteList []int64 `json:"white_list" yaml:"white_list" mapstructure:"white_list"`
	} `json:"tg" yaml:"tg" mapstructure:"tg"`
	Web struct {
		Enable     bool              `json:"enable" yaml:"enable" mapstructure:"enable"`
		Account    string            `json:"account" yaml:"account" mapstructure:"account"`
		Password   string            `json:"password" yaml:"password" mapstructure:"password"`
		Host       string            `json:"host" yaml:"host" mapstructure:"host"`
		Port       int               `json:"port" yaml:"port" mapstructure:"port"`
		CommonUser map[string]string `json:"common_user" yaml:"common_user" mapstructure:"common_user"`
	} `json:"web" yaml:"web" mapstructure:"web"`
	QQ struct {
		Enable      bool    `json:"enable" mapstructure:"enable"`
		PostAddr    string  `json:"post_addr" mapstructure:"post_addr"`
		SuperUser   int64   `json:"super_user" mapstructure:"super_user"`
		WhiteList   []int64 `json:"white_list" mapstructure:"white_list"`
		AccessToken string  `json:"access_token" mapstructure:"access_token"`
	}
	Cron           string `json:"cron" yaml:"cron" mapstructure:"cron"`
	CronRandomWait int    `json:"cron_random_wait" yaml:"cron_random_wait" mapstructure:"cron_random_wait"`
	EdgePath       string `json:"edge_path" yaml:"edge_path" mapstructure:"edge_path"`
	StartWait      int    `json:"start_wait" yaml:"start_wait" mapstructure:"start_wait"`
	// cookie强制过期时间,单位为h
	ForceExpiration int `json:"force_expiration" yaml:"force_expiration" mapstructure:"force_expiration"`
	Retry           struct {
		// 重试次数
		Times int `json:"times" yaml:"times" mapstructure:"times"`
		// 重试时间
		Intervals int `json:"intervals" yaml:"intervals" mapstructure:"intervals"`
	} `json:"retry" yaml:"retry" mapstructure:"retry"`

	Wechat struct {
		Enable        bool   `json:"enable" yaml:"enable" mapstructure:"enable"`
		Token         string `json:"token" yaml:"token" mapstructure:"token"`
		Secret        string `json:"secret" yaml:"secret" mapstructure:"secret"`
		AppID         string `json:"app_id" yaml:"app_id" mapstructure:"app_id"`
		LoginTempID   string `json:"login_temp_id" yaml:"login_temp_id" mapstructure:"login_temp_id"`
		NormalTempID  string `json:"normal_temp_id" yaml:"normal_temp_id" mapstructure:"normal_temp_id"`
		PushLoginWarn bool   `json:"push_login_warn" yaml:"push_login_warn" mapstructure:"push_login_warn"`
		SuperOpenID   string `json:"super_open_id" yaml:"super_open_id" mapstructure:"super_open_id"`
	} `json:"wechat" yaml:"wechat" mapstructure:"wechat"`
	// 专项答题可接受的最小值
	SpecialMinScore int `json:"special_min_score" yaml:"special_min_score" mapstructure:"special_min_score"`

	PushDeer struct {
		Enable bool   `json:"enable" yaml:"enable" mapstructure:"enable"`
		Api    string `json:"api" yaml:"api" mapstructure:"api"`
		Token  string `json:"token" yaml:"token" mapstructure:"token"`
	} `json:"push_deer" yaml:"push_deer" mapstructure:"push_deer"`

	ReverseOrder bool `json:"reverse_order" yaml:"reverse_order" mapstructure:"reverse_order"`

	JiGuangPush struct {
		Enable bool   `json:"enable" yaml:"enable" mapstructure:"enable"`
		Secret string `json:"secret" yaml:"secret" mapstructure:"secret"`
		AppKey string `json:"app_key" yaml:"app_key" mapstructure:"app_key"`
	} `json:"ji_guang_push" yaml:"ji_guang_push" mapstructure:"ji_guang_push"`

	// github的代理地址,用于检查更新或者其他的
	GithubProxy string `json:"github_proxy" yaml:"github_proxy" mapstructure:"github_proxy"`
	// 热重载
	HotReload bool `json:"hot_reload" yaml:"hot_reload" mapstructure:"hot_reload"`

	// 自定义消息推送
	CustomMessage string `json:"custom_message" yaml:"custom_message"  mapstructure:"custom_message"`

	CustomCron string `json:"custom_cron" yaml:"custom_cron" mapstructure:"custom_cron"`

	PoolSize int `json:"pool_size" yaml:"pool_size" mapstructure:"pool_size"`
	// contains filtered or unexported fields
}

Config

@Description:

func GetConfig

func GetConfig() Config

GetConfig *

  • @Description: 获取配置信息
  • @return Config

Jump to

Keyboard shortcuts

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