config

package
v0.0.0-...-8110dd7 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2020 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TokenSign     = "pepper_bus"
	DefaultAvatar = "https://avatars0.githubusercontent.com/u/58962967?s=60&v=4"
)

Variables

View Source
var (
	MySQL       *gorm.DB
	ETCDClient  *clientv3.Client
	RedisClient redis.Cmdable
)
View Source
var (
	FilePath string
	Mode     string
)

Functions

func Init

func Init()

func InitDBs

func InitDBs()

Types

type Base

type Base struct {
	Listen        int    `yaml:"listen"`
	AdminPassword string `yaml:"admin-pass"`
}

type Config

type Config struct {
	Dashboard Base     `yaml:"dashboard"`
	Keeper    Keeper   `yaml:"gokeeper"`
	LDAP      LDAP     `yaml:"ldap"`
	MySQL     Database `yaml:"mysql"`
	Redis     Redis    `yaml:"redis"`
	ETCD      ETCD     `yaml:"etcd"`
}
var (
	GlobalConfig Config
	HttpClient   = &http.Client{
		Transport: &http.Transport{
			DialContext: (&net.Dialer{
				Timeout:   5 * time.Second,
				KeepAlive: 5 * time.Second,
			}).DialContext,
			IdleConnTimeout:     10 * time.Second,
			MaxIdleConnsPerHost: 10,
		},
		Timeout: 5 * time.Second,
	}
)

type Database

type Database struct {
	Host     string `yaml:"host"`
	Port     int    `yaml:"port"`
	Name     string `yaml:"database"`
	User     string `yaml:"username"`
	Password string `yaml:"password"`
}

func (Database) String

func (m Database) String() string

type ETCD

type ETCD struct {
	EndPoints []string `yaml:"endpoints"`
	Username  string   `yaml:"username"`
	Password  string   `yaml:"password"`
}

type Keeper

type Keeper struct {
	DiscoverAddress string `yaml:"discover"`
	AdminAddress    string `yaml:"admin-addr"`
	Domain          string `yaml:"domain"`
}

type LDAP

type LDAP struct {
	Enable  bool   `yaml:"enable"`
	Address string `yaml:"address"`
	BaseDN  string `yaml:"base-dn"`
}

type Redis

type Redis struct {
	Host     string `yaml:"host"`
	Port     int    `yaml:"port"`
	Password string `yaml:"password"`
	DB       int    `yaml:"db"`
}

func (Redis) Options

func (m Redis) Options() *redis.Options

Jump to

Keyboard shortcuts

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