config

package
v0.0.0-...-5b7ebeb Latest Latest
Warning

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

Go to latest
Published: May 16, 2024 License: LGPL-2.1 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultAppConfig = &AppConfig{
	System: SysConfig{
		Appid:    "Logsight",
		Location: "Asia/Shanghai",
		Workdir:  "/var/logsight",
		Debug:    true,
	},
	Web: WebConfig{
		Host:    "0.0.0.0",
		Port:    1816,
		TlsPort: 1817,
		Secret:  "9b6de5cc-0731-1203-xxtt-0f568ac9da37",
	},
	Database: DBConfig{
		Type:     "postgres",
		Host:     "127.0.0.1",
		Port:     5432,
		Name:     "logsight",
		User:     "postgres",
		Passwd:   "myroot",
		MaxConn:  100,
		IdleConn: 10,
		Debug:    false,
	},
	Syslogd: SyslogdConfig{
		Host:  "0.0.0.0",
		Port:  1814,
		Debug: true,
	},
	Logger: LogConfig{
		Mode:           "development",
		ConsoleEnable:  true,
		LokiEnable:     false,
		FileEnable:     true,
		Filename:       "/var/logsight/logsight.log",
		QueueSize:      4096,
		LokiApi:        "http://127.0.0.1:3100",
		LokiUser:       "logsight",
		LokiPwd:        "logsight",
		LokiJob:        "logsight",
		MetricsStorage: "/var/logsight/data/metrics",
		MetricsHistory: 24 * 7,
	},
}

Functions

This section is empty.

Types

type AppConfig

type AppConfig struct {
	System   SysConfig     `yaml:"system" json:"system"`
	Web      WebConfig     `yaml:"web" json:"web"`
	Database DBConfig      `yaml:"database" json:"database"`
	Syslogd  SyslogdConfig `yaml:"syslogd" json:"syslogd"`
	Logger   LogConfig     `yaml:"logger" json:"logger"`
}

func LoadConfig

func LoadConfig(cfile string) *AppConfig

func (*AppConfig) GetBackupDir

func (c *AppConfig) GetBackupDir() string

func (*AppConfig) GetDataDir

func (c *AppConfig) GetDataDir() string

func (*AppConfig) GetLogDir

func (c *AppConfig) GetLogDir() string

func (*AppConfig) GetPrivateDir

func (c *AppConfig) GetPrivateDir() string

func (*AppConfig) GetPublicDir

func (c *AppConfig) GetPublicDir() string

type DBConfig

type DBConfig struct {
	Type     string `yaml:"type"`
	Host     string `yaml:"host"`
	Port     int    `yaml:"port"`
	Name     string `yaml:"name"`
	User     string `yaml:"user"`
	Passwd   string `yaml:"passwd"`
	MaxConn  int    `yaml:"max_conn"`
	IdleConn int    `yaml:"idle_conn"`
	Debug    bool   `yaml:"debug"`
}

DBConfig 数据库(PostgreSQL)配置

type LogConfig

type LogConfig struct {
	Mode           string `yaml:"mode"`
	ConsoleEnable  bool   `yaml:"console_enable"`
	LokiEnable     bool   `yaml:"loki_enable"`
	FileEnable     bool   `yaml:"file_enable"`
	Filename       string `yaml:"filename"`
	QueueSize      int    `yaml:"queue_size"`
	LokiApi        string `yaml:"loki_api"`
	LokiUser       string `yaml:"loki_user"`
	LokiPwd        string `yaml:"loki_pwd"`
	LokiJob        string `yaml:"loki_job"`
	MetricsStorage string `yaml:"metrics_storage"`
	MetricsHistory int    `yaml:"metrics_history"`
}

type SysConfig

type SysConfig struct {
	Appid    string `yaml:"appid"`
	Location string `yaml:"location"`
	Workdir  string `yaml:"workdir"`
	Debug    bool   `yaml:"debug"`
}

SysConfig 系统配置

type SyslogdConfig

type SyslogdConfig struct {
	Host  string `yaml:"host" json:"host"`
	Port  int    `yaml:"port" json:"port"`
	Debug bool   `yaml:"debug" json:"debug"`
}

type WebConfig

type WebConfig struct {
	Host    string `yaml:"host"`
	Port    int    `yaml:"port"`
	TlsPort int    `yaml:"tls_port"`
	Secret  string `yaml:"secret"`
}

WebConfig WEB 配置

Jump to

Keyboard shortcuts

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