config

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2025 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parse

func Parse() error

Parse 解析配置文件,支持本地文件系统和网络链接

func SetConfigFilePath

func SetConfigFilePath(path string)

Types

type ConfigOptions

type ConfigOptions struct {
	Log struct {
		ConsoleLevel string `json:"console-level" yaml:"console-level"`
		FileLevel    string `json:"file-level" yaml:"file-level"`
		FilePath     string `json:"file-path" yaml:"file-path"`
	} `json:"log" yaml:"log"`

	Web struct {
		Port string `json:"port" yaml:"port"`
	}

	SourceFiles []string `json:"source-files" yaml:"source-files"`
	// DatabaseUrl   string   `json:"database-url" yaml:"database-url"`
	// TGApiUrl      string   `json:"TG-api-url" yaml:"TG-api-url"`
	CrawlInterval uint64 `json:"crawl-interval" yaml:"crawl-interval"`

	HealthCheck struct {
		Url string `json:"url" yaml:"url"`
	} `json:"healthcheck" yaml:"healthcheck"`

	// RenameFormat 重命名格式
	RenameFormat string `json:"rename-format" yaml:"rename-format"`

	LocalCheck struct {
		Url           string `json:"url" yaml:"url"`
		JsonPath      string `json:"json-path" yaml:"json-path"`
		Timeout       int    `json:"timeout" yaml:"timeout"`
		MaxConnection int    `json:"max-conn" yaml:"max-conn"`
	} `json:"localcheck" yaml:"localcheck"`

	SpeedTest struct {
		Url           string `json:"url" yaml:"url"`
		IsUsed        bool   `json:"is-used" yaml:"is-used"`
		Interval      uint64 `json:"interval" yaml:"interval"`
		Timeout       int    `json:"timeout" yaml:"timeout"`
		MaxConnection int    `json:"max-conn" yaml:"max-conn"`
	} `json:"speedtest" yaml:"speedtest"`
}
var Config ConfigOptions

Config 配置

type Source

type Source struct {
	Type    string                 `json:"type" yaml:"type"`
	Options map[string]interface{} `json:"options" yaml:"options"`
}

Jump to

Keyboard shortcuts

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