config

package
v2.0.88 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultGroupName  = "default" // Default configuration group name.
	MemoryQueueName   = "memory"
	RabbitmqQueueName = "rabbitmq"
	RocketQueueName   = "rocketmq"
)

Variables

This section is empty.

Functions

func GetQueueName added in v2.0.9

func GetQueueName(typeName, name string) string

func GetTLS added in v2.0.28

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

Types

type Bootstrap added in v2.0.27

type Bootstrap struct {
	// contains filtered or unexported fields
}

func NewBootstrap added in v2.0.29

func NewBootstrap(ctx context.Context, app app.IRuntime) *Bootstrap

func (*Bootstrap) After added in v2.0.28

func (b *Bootstrap) After(after ...boot.BootFunc) boot.IBootstrap

func (*Bootstrap) Before added in v2.0.28

func (b *Bootstrap) Before(before ...boot.BootFunc) boot.IBootstrap

func (*Bootstrap) Process added in v2.0.28

func (b *Bootstrap) Process(boots ...boot.Initialize) boot.IBootstrap

func (*Bootstrap) Run added in v2.0.28

func (b *Bootstrap) Run() error

type BotGroups added in v2.0.28

type BotGroups struct {
	Default *TgBot `json:"default,omitempty"`
}

type Config

type Config struct {
	Database map[string]*gdb.ConfigNode     `json:"database"`
	Redis    map[string]*RedisOptions       `json:"redis"`
	Server   *ghttp.ServerConfig            `json:"server"`
	Settings *SettingOptions                `json:"settings"`
	Bot      *BotGroups                     `json:"bot,omitempty"`
	Telegram *telegram.SendConf             `json:"telegram,omitempty"`
	Erlang   map[string]*service.NodeConfig `json:"erlang,omitempty"`
}

func Global added in v2.0.28

func Global() *Config

func (*Config) Load added in v2.0.28

func (c *Config) Load(ctx context.Context, cfg *gcfg.Config) error

type CryptoOptions added in v2.0.28

type CryptoOptions struct {
	Enable    bool                      `json:"enable" yaml:"enable"`
	Algorithm string                    `json:"algorithm" yaml:"algorithm"`
	Rc4       security.Rc4CipherConfig  `json:"rc4" yaml:"rc4"`
	Rsa       security.RsaCiphersConfig `json:"rsa" yaml:"rsa"`
	Aes       security.AesCipherConfig  `json:"aes" yaml:"aes"`
}

type FailedLimitOptions added in v2.0.28

type FailedLimitOptions struct {
	Limit  int64 `json:"limit,omitempty"`
	Expire int64 `json:"expire,omitempty"`
}

type JwtAuth added in v2.0.28

type JwtAuth struct {
	Jwt *JwtOptions `json:"jwt,omitempty"`
}

type JwtOptions added in v2.0.28

type JwtOptions struct {
	Secret          string `yaml:"secret" json:"secret"`
	SigningKey      string `yaml:"signingKey" json:"signing_key"`
	Timeout         int64  `yaml:"timeout" json:"timeout"`
	MaxRefresh      int64  `yaml:"maxRefresh" json:"max_refresh"`
	IdentityKey     string `yaml:"identityKey" json:"identity_key"`
	BlacklistPrefix string `yaml:"blacklistPrefix" json:"blacklistPrefix"`
}

type MemoryOptions added in v2.0.28

type MemoryOptions struct {
	PoolSize uint `json:"poolSize,omitempty"`
}

type MetricsOptions added in v2.0.28

type MetricsOptions struct {
	Enable          bool      `json:"enable" yaml:"enable"`
	Path            string    `json:"path" yaml:"path"`
	SlowTime        int32     `json:"slowTime" yaml:"slowTime"`
	RequestDuration []float64 `json:"requestDuration" yaml:"requestDuration"`
}

type NSQOptions

type NSQOptions struct {
	DialTimeout time.Duration `opt:"dial_timeout" default:"1s"`

	// Deadlines for network reads and writes
	ReadTimeout  time.Duration `opt:"read_timeout" min:"100ms" max:"5m" default:"60s"`
	WriteTimeout time.Duration `opt:"write_timeout" min:"100ms" max:"5m" default:"1s"`
	// Addresses is the local address to use when dialing an nsqd.
	Addresses     []string `opt:"addresses"`
	ChannelPrefix string
}

type QueueGroups added in v2.0.28

type QueueGroups struct {
	Memory   *MemoryOptions              `json:"memory,omitempty"`
	Rabbitmq map[string]*RabbitmqOptions `json:"rabbitmq,omitempty"`
	Rocketmq map[string]*RocketmqOptions `json:"rocketmq,omitempty"`
	Nsq      *NSQOptions                 `json:"nsq"`
}

type RabbitmqOptions added in v2.0.28

type RabbitmqOptions struct {
	DSN               string           `json:"dsn,omitempty"`
	Vhost             string           `json:"vhost,omitempty"`
	ChannelMax        int64            `json:"channelMax,omitempty"`
	FrameSize         int64            `json:"frameSize,omitempty"`
	Heartbeat         int64            `json:"heartbeat,omitempty"`
	ReconnectInterval int              `json:"reconnectInterval,omitempty"`
	MaxConnections    int              `json:"maxConnections,omitempty"`
	Cfg               *rabbitmq.Config `json:"cfg" yaml:"cfg"`
	LogPath           string           `json:"logPath,omitempty"`
	LogFile           string           `json:"logFile,omitempty"`
	LogLevel          string           `json:"logLevel,omitempty"`
	LogStdout         bool             `json:"logStdout,omitempty"`
}

type RateLimitOptions added in v2.0.44

type RateLimitOptions struct {
	Bucket int `json:"bucket" yaml:"bucket"`
	// refilled at rate “r” tokens per second.
	Limit int `json:"limit" yaml:"limit"`
	// It implements a “token bucket” of size “b”
	Burst int `json:"burst" yaml:"burst"`
	// exclude ip list
	Exclude []string `json:"exclude,omitempty" yaml:"exclude,omitempty"`
}

type RedisOptions added in v2.0.33

type RedisOptions struct {
	gredis.Config
	// Base number of socket connections.
	// Default is 10 connections per every available CPU as reported by runtime.GOMAXPROCS.
	// If there are not enough connections in the pool, new connections will be allocated in excess of PoolSize;
	// you can limit it through MaxActiveConns
	PoolSize int ` yaml:"poolSize" json:"poolSize"`
}

type RocketmqOptions added in v2.0.28

type RocketmqOptions struct {
	Urls []string `json:"urls,omitempty"`
	*primitive.Credentials
	LogPath   string `json:"logPath,omitempty"`
	LogFile   string `json:"logFile,omitempty"`
	LogLevel  string `json:"logLevel,omitempty"`
	LogStdout bool   `json:"logStdout,omitempty"`
}

type SettingOptions added in v2.0.28

type SettingOptions struct {
	System      *System                        `json:"system,omitempty"`
	Queue       *QueueGroups                   `json:"queue,omitempty"`
	Uploads     *UploadGroups                  `json:"uploads,omitempty"`
	Auth        map[string]*JwtAuth            `json:"auth,omitempty"`
	Websocket   *ws.Config                     `json:"websocket,omitempty"`
	FailedLimit map[string]*FailedLimitOptions `json:"failedLimit,omitempty"`
	Metrics     *MetricsOptions                `json:"metrics,omitempty"`
	RateLimit   *RateLimitOptions              `json:"rateLimit,omitempty"`
}

type System added in v2.0.28

type System struct {
	EnableCAPTCHA  bool           `json:"enableCaptcha,omitempty"`
	Logger         *SystemLogger  `json:"logger,omitempty"`
	DataPermission bool           `json:"dataPermission,omitempty"`
	Crypto         *CryptoOptions `json:"crypto,omitempty"`
}

type SystemLogger added in v2.0.28

type SystemLogger struct {
	EnabledDB bool `json:"enabledDb,omitempty"`
}

type TgBot added in v2.0.28

type TgBot struct {
	LogPath   string `json:"logPath,omitempty"`
	LogFile   string `json:"logFile,omitempty"`
	LogLevel  string `json:"logLevel,omitempty"`
	LogStdout bool   `json:"logStdout,omitempty"`
	HookUrl   string `json:"hook,omitempty"`
	Token     string `json:"token,omitempty"`
}

type Tls

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

type TusOptions added in v2.0.28

type TusOptions struct {
	Path      string `json:"path,omitempty"`
	BasePath  string `json:"basePath,omitempty"`
	LogPath   string `json:"logPath,omitempty"`
	LogFile   string `json:"logFile,omitempty"`
	LogLevel  string `json:"logLevel,omitempty"`
	LogStdout bool   `json:"logStdout,omitempty"`
}

type UploadGroups added in v2.0.28

type UploadGroups struct {
	Normal *UploadOptions         `json:"normal,omitempty"`
	Tus    map[string]*TusOptions `json:"tus,omitempty"`
}

type UploadOptions added in v2.0.28

type UploadOptions struct {
	Path     string `json:"path,omitempty"`
	BasePath string `json:"basePath,omitempty"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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