config

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2022 License: MIT Imports: 25 Imported by: 15

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(filename string, cfg Entity) error

Init 初始化配置

Types

type Client

type Client struct {
	Addr    string `yaml:"addr" json:"addr"`
	Timeout int    `yaml:"timeout" json:"timeout"`
}

Client client

type Clients

type Clients map[string]Client

Clients clients

func (Clients) Init

func (e Clients) Init() error

Init init

type Entity

type Entity interface {
	OnChange()
}

Entity 配置实体

type GRPC

type GRPC struct {
	Addr     string `yaml:"addr" json:"addr"` // default:  :9090
	CertFile string `yaml:"certFile" json:"certFile"`
	KeyFile  string `yaml:"keyFile" json:"keyFile"`
	Timeout  int    `yaml:"timeout" json:"timeout"` // default: 10
}

GRPC grpc服务公共配置(选用)

func (*GRPC) Init

func (e *GRPC) Init(
	register func(srv *grpc.Server),
	opts ...grpc.Option) server.Runnable

Init init

type Listen

type Listen struct {
	Addr     string `yaml:"addr" json:"addr"`
	CertFile string `yaml:"certFile" json:"certFile"`
	KeyFile  string `yaml:"keyFile" json:"keyFile"`
	Timeout  int    `yaml:"timeout" json:"timeout"` // default: 10s
}

func (*Listen) Init

func (e *Listen) Init(opts ...listener.Option) []listener.Option

type Logger

type Logger struct {
	Type      string `yaml:"type" json:"type"`
	Path      string `yaml:"path" json:"path"`
	Level     string `yaml:"level" json:"level"`
	Stdout    string `yaml:"stdout" json:"stdout"`
	Cap       uint   `yaml:"cap" json:"cap"`
	Formatter string `yaml:"formatter" json:"formatter"`
}

Logger logger配置

func (*Logger) Init

func (e *Logger) Init()

Init 初始化日志

type OAuth2

type OAuth2 struct {
	Issuer       string   `yaml:"issuer" json:"issuer"`
	ClientID     string   `yaml:"clientID" json:"clientID"`
	ClientSecret string   `yaml:"clientSecret" json:"clientSecret"`
	Scopes       []string `yaml:"scopes" json:"scopes"`
	RedirectURL  string   `yaml:"redirectURL" json:"redirectURL"`
}

OAuth2 holds the configuration for the OAuth2 provider.

func (*OAuth2) GetClientID

func (e *OAuth2) GetClientID() string

GetClientID returns the OAuth2 client ID.

func (*OAuth2) GetClientSecret

func (e *OAuth2) GetClientSecret() string

GetClientSecret returns the OAuth2 client secret.

func (*OAuth2) GetIssuer

func (e *OAuth2) GetIssuer() string

GetIssuer returns the OAuth2 issuer.

func (*OAuth2) GetOAuth2Config

func (e *OAuth2) GetOAuth2Config(c context.Context) (*oauth2.Config, error)

GetOAuth2Config returns an oauth2.Config.

func (*OAuth2) GetRedirectURL

func (e *OAuth2) GetRedirectURL() string

GetRedirectURL returns the OAuth2 redirect URL.

func (*OAuth2) GetScopes

func (e *OAuth2) GetScopes() []string

GetScopes returns the OAuth2 scopes.

type Tls

type Tls struct {
	Cert string `yaml:"cert" json:"cert"`
	Key  string `yaml:"key" json:"key"`
	Ca   string `yaml:"ca" json:"ca"`
}

func (*Tls) GetTLS

func (c *Tls) GetTLS() (*tls.Config, error)

GetTLS get tls config

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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