config

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: May 28, 2023 License: MIT Imports: 31 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

View Source
var URLTemplate = map[ProviderType]string{
	OSS:  "https://%s.aliyuncs.com",
	OOS:  "https://oos-%s.ctyunapi.cn",
	KODO: "https://s3-%s.qiniucs.com",
	COS:  "https://cos.%s.myqcloud.com",
	OBS:  "https://obs.%s.myhuaweicloud.com",
	BOS:  "https://s3.%s.bcebos.com",
	GCS:  "https://storage.googleapis.com",
	KS3:  "https://ks3-%s.ksyuncs.com",
}

Functions

func Init

func Init(cfg any, options ...source.Option) (err error)

Init 初始化配置

Types

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 {
	Name     string `yaml:"name" json:"name"`
	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
	Metrics  bool   `yaml:"metrics" json:"metrics"`
	Healthz  bool   `yaml:"healthz" json:"healthz"`
	Readyz   bool   `yaml:"readyz" json:"readyz"`
	Pprof    bool   `yaml:"pprof" json:"pprof"`
}

func (*Listen) Init

func (e *Listen) Init(opts ...listener.Option) server.Runnable

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 ProviderType added in v0.0.3

type ProviderType string
const (
	S3   ProviderType = "s3"   //aws s3
	OSS  ProviderType = "oss"  //aliyun oss
	OOS  ProviderType = "oos"  //ctyun oos
	KODO ProviderType = "kodo" //qiniu kodo
	COS  ProviderType = "cos"  //tencent cos
	OBS  ProviderType = "obs"  //huawei obs
	BOS  ProviderType = "bos"  //baidu bos
	GCS  ProviderType = "gcs"  //google gcs fixme:not tested
	KS3  ProviderType = "ks3"  //kingsoft ks3
)

type Storage added in v0.0.3

type Storage struct {
	Type            ProviderType `yaml:"type"`
	SigningMethod   string       `yaml:"signingMethod"`
	Region          string       `yaml:"region"`
	Bucket          string       `yaml:"bucket"`
	AccessKeyID     string       `yaml:"accessKeyID"`
	SecretAccessKey string       `yaml:"secretAccessKey"`
	// contains filtered or unexported fields
}

func (*Storage) GetClient added in v0.0.3

func (o *Storage) GetClient() *s3.Client

GetClient get client

func (*Storage) Init added in v0.0.3

func (o *Storage) Init()

Init init

type Task added in v0.0.9

type Task struct {
}

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
fs
s3

Jump to

Keyboard shortcuts

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