conf

package
v1.1.7 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Command added in v1.1.7

func Command(conf, appkey *string)

Command command

func FileDir

func FileDir() string

FileDir if app config configuration fileDir return it,orherwise return app exec path

func Init

func Init()

Init data

func Lang added in v1.1.7

func Lang() string

Lang returns lang

func Log added in v1.1.7

func Log() *logs.Conf

Log returns the current log config

func OK

func OK() bool

OK check conf

func Path

func Path() string

Path returns the current config path

func Register added in v1.1.5

func Register(handle ConfingHandle, finish ...FinishHandle)

Register regist handler of conf

func SameSite added in v1.1.3

func SameSite() http.SameSite

SameSite if app config configuration cookie sameSite return it,orherwise return 'None'

func Session added in v1.1.7

func Session() *sessionConf.Conf

Session return session conf

func SetPath added in v1.1.5

func SetPath(confPath string)

SetPath set the current config path

func Trans added in v1.1.7

func Trans() string

Trans returns Trans conf

func User added in v1.1.7

func User() interface{}

User returns the current user config

func Wrap added in v1.1.5

func Wrap() bool

Wrap wrap response body

Types

type AppConf

type AppConf struct {
	Key          string            `json:"key"`
	Name         string            `json:"name"`
	Addr         string            `json:"addr"`
	CertFile     string            `json:"certFile"` //tls cert file
	KeyFile      string            `json:"keyFile"`  //tls cert key file
	FileDir      string            `json:"fileDir"`
	Debug        bool              `json:"debug"`
	BaseURL      string            `json:"baseUrl"`
	IDNode       uint8             `json:"idNode"`    //id node
	Lang         string            `json:"lang"`      //lang
	Trans        string            `json:"trans"`     //trans
	SameSiteText string            `json:"sameSite"`  //strict|lax|none
	Wrap         *bool             `json:"wrap"`      //wrap response body
	Session      *sessionConf.Conf `json:"session"`   //session
	Log          *logs.Conf        `json:"log"`       //log conf
	CORS         *CORSConf         `json:"cors"`      //CORS
	Conf         interface{}       `json:"conf"`      //user conf
	Extend       string            `json:"extend"`    //user extend
	Page         *PaginationConf   `json:"page"`      //pagination conf
	Registry     *RegistryConf     `json:"registry"`  //service registry center
	Discovery    *DiscoveryConf    `json:"discovery"` //service discovery center
	SameSite     http.SameSite     `json:"-"`
	// contains filtered or unexported fields
}

AppConf app config item

func Conf

func Conf() *AppConf

Conf returns the current app config

func Confs

func Confs() []AppConf

Confs returns the all app configs

func WithKey added in v1.1.7

func WithKey(key string) *AppConf

WithKey returns the key app config

func WithPath added in v1.1.5

func WithPath(path string) *AppConf

WithPath returns the current app config

func WithPaths added in v1.1.7

func WithPaths(path string) []AppConf

WithPaths returns the all app config

type AppConfMgr

type AppConfMgr struct {
	Confs map[string]*AppConf
	// contains filtered or unexported fields
}

AppConfMgr app config

func Manager

func Manager() *AppConfMgr

Manager is manager all config objects

type CORSConf added in v1.1.4

type CORSConf struct {
	AllowOrigin      string `json:"allowOrigin"`
	AllowMethods     string `json:"allowMethods"`
	AllowHeaders     string `json:"allowHeaders"`
	AllowCredentials string `json:"allowCredentials"`
	MaxAge           string `json:"maxAge"`
}

CORSConf config

func CORS added in v1.1.4

func CORS() *CORSConf

CORS returns the current log config

type ConfingHandle

type ConfingHandle func(appConf *AppConf) error

ConfingHandle handler conf

type DiscoveryConf added in v1.1.7

type DiscoveryConf struct {
	Enable      bool   `json:"enable"`    //
	Prefix      string `json:"prefix"`    //
	Endpoints   string `json:"endpoints"` //localhost:2379,localhost:22379
	DialTimeout int64  `json:"timeout"`   //second default 5s
}

DiscoveryConf config

func Discovery added in v1.1.7

func Discovery() *DiscoveryConf

Discovery return service discovery conf

type FinishHandle

type FinishHandle func(appConf *AppConf) error

FinishHandle finished handler conf

type PaginationConf added in v1.1.7

type PaginationConf struct {
	Page    string `json:"page"`
	Total   string `json:"total"`
	PageRow string `json:"pageRow"`
}

PaginationConf config

func Page added in v1.1.7

func Page() *PaginationConf

Page return Pagination conf

type RegistryConf added in v1.1.7

type RegistryConf struct {
	Enable      bool   `json:"enable"`    //
	BaseURL     string `json:"baseUrl"`   //
	Prefix      string `json:"prefix"`    //
	Endpoints   string `json:"endpoints"` //localhost:2379,localhost:22379
	DialTimeout int64  `json:"timeout"`   //second default 5s
	TTL         int64  `json:"ttl"`
}

RegistryConf config

func Registry added in v1.1.7

func Registry() *RegistryConf

Registry return service registry conf

Jump to

Keyboard shortcuts

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