config

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckConfigDirPermisson

func CheckConfigDirPermisson(dir string) bool

CheckConfigDirPermisson 检查配置文件目录是否有权限

func CheckConfigFile

func CheckConfigFile(path string) (bool, error)

CheckConfigFile 检查配置文件是否存在

func CreateConfigDir

func CreateConfigDir(dir string)

CreateConfigDir 创建配置文件目录

func WriteConfigToFile

func WriteConfigToFile(file string, content []byte) bool

WriteConfigToFile 写入配置文件

Types

type Auth

type Auth struct {
	Secret string `json:"secret" yaml:"secret" validate:"required"`
	TTL    int64  `json:"ttl" yaml:"ttl" validate:"required"`
}

type Config

type Config struct {
	Database     `json:"database"`
	Auth         `json:"auth"`
	Etcd         `json:"etcd"`
	Notification `json:"notification"`
}
var Conf *Config

func Init

func Init() *Config

type Database

type Database struct {
	Host string `json:"host" yaml:"host" validate:"required"`
	Port int    `json:"port" yaml:"port" validate:"required"`
	Name string `json:"name" yaml:"name" validate:"required"`
	User string `json:"user" yaml:"user" validate:"required"`
	Pass string `json:"pass" yaml:"pass" validate:"required"`
	Char string `json:"char" yaml:"char" validate:"required"`
}

type Etcd

type Etcd struct {
	Killer    string   `json:"killer" yaml:"killer" validate:"required"`
	Locker    string   `json:"locker" yaml:"locker" validate:"required"`
	Service   string   `json:"service" yaml:"service" validate:"required"`
	Pipeline  string   `json:"pipeline" yaml:"pipeline" validate:"required"`
	Config    string   `json:"config" yaml:"config" validate:"required"`
	EndPoints []string `json:"endpoints" yaml:"endpoints" validate:"required"`
	Timeout   int64    `json:"timeout" yaml:"timeout" validate:"required"`
}

type Notification

type Notification struct {
	Url        string `json:"url" yaml:"url" validate:"required"`
	Host       string `json:"host" yaml:"host" validate:"required"`
	Port       int    `json:"port" yaml:"port" validate:"numeric"`
	User       string `json:"user" yaml:"user" validate:"required"`
	Pass       string `json:"pass" yaml:"pass" validate:"required"`
	Name       string `json:"name" yaml:"name" validate:"required"`
	Protocol   string `json:"protocol" yaml:"protocol" validate:"required"`
	Encryption string `json:"encryption" yaml:"encryption" validate:"required"`
}

type User

type User struct {
	Name    string `json:"name" yaml:"-" validate:"required"`
	Email   string `json:"email" yaml:"-" validate:"required"`
	Pass    string `json:"pass" yaml:"-" validate:"required"`
	Confirm string `json:"confirm" yaml:"-" validate:"required"`
}

Jump to

Keyboard shortcuts

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