config

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2024 License: LGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultAppConfig = &AppConfig{
	System: SysConfig{
		Appid:    "TeamsACS",
		Location: "Asia/Shanghai",
		Workdir:  "/var/teamsacs",
		Debug:    true,
	},
	Web: WebConfig{
		Host:    "0.0.0.0",
		Port:    2979,
		TlsPort: 2989,
		Secret:  "9b6de5cc-0001-1203-1100-0f568ac7da37",
	},
	Database: DBConfig{
		Type:     "postgres",
		Host:     "127.0.0.1",
		Port:     5432,
		Name:     "teamsacs_v1",
		User:     "postgres",
		Passwd:   "myroot",
		MaxConn:  100,
		IdleConn: 10,
		Debug:    false,
	},
	Tr069: Tr069Config{
		Host:   "0.0.0.0",
		Tls:    true,
		Port:   2999,
		Secret: "9b6de5cc-1q21-1203-xxtt-0f568ac9d237",
		Debug:  true,
	},
	Mqtt: MqttConfig{
		Server:   "",
		Username: "",
		Password: "",
		Debug:    false,
	},
}

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"`
	Tr069    Tr069Config `yaml:"tr069" json:"tr069"`
	Mqtt     MqttConfig  `yaml:"mqtt" json:"mqtt"`
}

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

func (*AppConfig) InitDirs

func (c *AppConfig) InitDirs()

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 Database (PostgreSQL) configuration

type MqttConfig

type MqttConfig struct {
	Server   string `yaml:"server" json:"server"`
	Username string `yaml:"username" json:"username"`
	Password string `yaml:"password" json:"password"`
	Debug    bool   `yaml:"debug" json:"debug"`
}

type SysConfig

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

SysConfig System Configuration

type Tr069Config

type Tr069Config struct {
	Host   string `yaml:"host" json:"host"`
	Port   int    `yaml:"port" json:"port"`
	Tls    bool   `yaml:"tls" json:"tls"`
	Secret string `yaml:"secret" json:"secret"`
	Debug  bool   `yaml:"debug" json:"debug"`
}

Tr069Config tr069 API Configuration

type WebConfig

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

WebConfig WEB Configuration

Jump to

Keyboard shortcuts

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