config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2024 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 {
		Domain string `json:"domain" yaml:"domain"`
		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"`
		Timeout       int    `json:"timeout" yaml:"timeout"`
		MaxConnection int    `json:"max-conn" yaml:"max-conn"`
	} `json:"healthcheck" yaml:"healthcheck"`

	SpeedTest struct {
		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 配置

func (ConfigOptions) HostUrl

func (config ConfigOptions) HostUrl() string

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