config

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

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

Go to latest
Published: Mar 1, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Version = "0.1.0" // Version admin version
	OK      = "10001"
	ERR     = "10002"
	RETRY   = "10003"
)

Variables

This section is empty.

Functions

func CloseEtcdClient

func CloseEtcdClient()

CloseEtcdClient close etcd client

func InitEtcdClient

func InitEtcdClient()

InitEtcdClient init etcd client

Types

type AdminBootstrap

type AdminBootstrap struct {
	Server      ServerConfig `yaml:"server" json:"server" mapstructure:"server"`
	EtcdConfig  EtcdConfig   `yaml:"etcd" json:"etcd" mapstructure:"etcd"`
	MysqlConfig MysqlConfig  `yaml:"mysql" json:"mysql" mapstructure:"mysql"`
}

AdminBootstrap admin bootstrap config

var (
	Client    *etcdv3.Client
	Bootstrap *AdminBootstrap
)

func LoadAPIConfigFromFile

func LoadAPIConfigFromFile(path string) (*AdminBootstrap, error)

LoadAPIConfigFromFile load config from file

func (*AdminBootstrap) GetAddress

func (a *AdminBootstrap) GetAddress() string

GetAddress get etcd server address

func (*AdminBootstrap) GetPath

func (a *AdminBootstrap) GetPath() string

GetPath get etcd config root path

type Autocode

type Autocode struct {
	TransferRestart bool   `mapstructure:"transfer-restart" json:"transferRestart" yaml:"transfer-restart"`
	Root            string `mapstructure:"root" json:"root" yaml:"root"`
	Server          string `mapstructure:"server" json:"server" yaml:"server"`
	SApi            string `mapstructure:"server-api" json:"serverApi" yaml:"server-api"`
	SInitialize     string `mapstructure:"server-initialize" json:"serverInitialize" yaml:"server-initialize"`
	SModel          string `mapstructure:"server-model" json:"serverModel" yaml:"server-model"`
	SRequest        string `mapstructure:"server-request" json:"serverRequest"  yaml:"server-request"`
	SRouter         string `mapstructure:"server-router" json:"serverRouter" yaml:"server-router"`
	SService        string `mapstructure:"server-service" json:"serverService" yaml:"server-service"`
	Web             string `mapstructure:"web" json:"web" yaml:"web"`
	WApi            string `mapstructure:"web-api" json:"webApi" yaml:"web-api"`
	WForm           string `mapstructure:"web-form" json:"webForm" yaml:"web-form"`
	WTable          string `mapstructure:"web-table" json:"webTable" yaml:"web-table"`
	WFlow           string `mapstructure:"web-flow" json:"webFlow" yaml:"web-flow"`
}

type BaseInfo

type BaseInfo struct {
	Name           string `json:"name" yaml:"name"`
	Description    string `json:"description" yaml:"description"`
	PluginFilePath string `json:"pluginFilePath" yaml:"pluginFilePath"`
}

BaseInfo base info

type EtcdConfig

type EtcdConfig struct {
	Address string `yaml:"address" json:"admin" mapstructure:"admin"`
	Path    string `yaml:"path" json:"path" mapstructure:"path"`
}

EtcdConfig admin etcd client config

type Mysql

type Mysql struct {
	Address      string `mapstructure:"address" json:"address" yaml:"address"` // host:port
	Config       string `mapstructure:"config" json:"config" yaml:"config"`
	Dbname       string `mapstructure:"db-name" json:"dbname" yaml:"db-name"`
	Username     string `mapstructure:"username" json:"username" yaml:"username"`
	Password     string `mapstructure:"password" json:"password" yaml:"password"`
	MaxIdleConns int    `mapstructure:"max-idle-conns" json:"maxIdleConns" yaml:"max-idle-conns"`
	MaxOpenConns int    `mapstructure:"max-open-conns" json:"maxOpenConns" yaml:"max-open-conns"`
	LogMode      string `mapstructure:"log-mode" json:"logMode" yaml:"log-mode"`
	LogZap       bool   `mapstructure:"log-zap" json:"logZap" yaml:"log-zap"`
}

func (*Mysql) Dsn

func (m *Mysql) Dsn() string

type MysqlConfig

type MysqlConfig struct {
	Username string `yaml:"username" json:"username" mapstructure:"username"`
	Password string `yaml:"password" json:"password" mapstructure:"password"`
	Host     string `yaml:"host" json:"host" mapstructure:"host"`
	Port     string `yaml:"port" json:"port" mapstructure:"port"`
	Dbname   string `yaml:"dbname" json:"dbname" mapstructure:"dbname"`
}

MysqlConfig admin mysql database config

type Redis

type Redis struct {
	DB       int    `mapstructure:"db" json:"db" yaml:"db"`
	Addr     string `mapstructure:"addr" json:"addr" yaml:"addr"`
	Password string `mapstructure:"password" json:"password" yaml:"password"`
}

type RetData

type RetData struct {
	Code string      `json:"code" yaml:"code"`
	Data interface{} `json:"data" yaml:"data"`
}

RetData response data

func WithError

func WithError(err error) RetData

WithError transform err to RetData

func WithRet

func WithRet(data interface{}) RetData

WithRet transform data to RetData

type Server

type Server struct {
	Zap    Zap    `mapstructure:"zap" json:"zap" yaml:"zap"`
	Redis  Redis  `mapstructure:"redis" json:"redis" yaml:"redis"`
	System System `mapstructure:"system" json:"system" yaml:"system"`

	AutoCode Autocode `mapstructure:"autoCode" json:"autoCode" yaml:"autoCode"`

	// gorm
	Mysql Mysql `mapstructure:"mysql" json:"mysql" yaml:"mysql"`
}

type ServerConfig

type ServerConfig struct {
	Address string `yaml:"address" json:"address" mapstructure:"address"`
}

ServerConfig admin http server config

type System

type System struct {
	Env    string `mapstructure:"env" json:"env" yaml:"env"`
	Addr   int    `mapstructure:"addr" json:"addr" yaml:"addr"`
	DbType string `mapstructure:"db-type" json:"dbType" yaml:"db-type"`
}

type Zap

type Zap struct {
	Level         string `mapstructure:"level" json:"level" yaml:"level"`
	Format        string `mapstructure:"format" json:"format" yaml:"format"`
	Prefix        string `mapstructure:"prefix" json:"prefix" yaml:"prefix"`
	Director      string `mapstructure:"director" json:"director"  yaml:"director"`
	LinkName      string `mapstructure:"link-name" json:"linkName" yaml:"link-name"`
	ShowLine      bool   `mapstructure:"show-line" json:"showLine" yaml:"showLine"`
	EncodeLevel   string `mapstructure:"encode-level" json:"encodeLevel" yaml:"encode-level"`
	StacktraceKey string `mapstructure:"stacktrace-key" json:"stacktraceKey" yaml:"stacktrace-key"`
	LogInConsole  bool   `mapstructure:"log-in-console" json:"logInConsole" yaml:"log-in-console"`
}

Jump to

Keyboard shortcuts

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