conf

package
v0.0.0-...-1b17b00 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthConf

type AuthConf struct {
	Disable             bool     `mapstructure:"disable"`
	SkippedPathPrefixes []string `mapstructure:"skipped_path_prefixes"`
	SigningMethod       string   `mapstructure:"signing_method"`  // HS256/HS384/HS512
	SigningKey          string   `mapstructure:"signing_key"`     // secret key
	OldSigningKey       string   `mapstructure:"old_signing_key"` // old secret key (for migration)
	Expired             int      `mapstructure:"expired"`         // seconds
}

type CasbinConf

type CasbinConf struct {
	Disable             bool     `mapstructure:"disable"`
	SkippedPathPrefixes []string `mapstructure:"skipped_path_prefixes"`
	LoadThread          int      `mapstructure:"load_thread"`
	AutoLoadInterval    int      `mapstructure:"auto_load_interval"`
	ModelFile           string   `mapstructure:"model_file"`
	GenPolicyFile       string   `mapstructure:"gen_policy_file"`
	WorkDir             string   `mapstructure:"work_dir"`
}

type ClickhouseConf

type ClickhouseConf struct {
	Addrs                   string `mapstructure:"addrs"`
	Database                string `mapstructure:"database"`
	Username                string `mapstructure:"username"`
	Password                string `mapstructure:"password"`
	MaxOpenConns            int    `mapstructure:"max_open_conns"`
	MaxIdleConns            int    `mapstructure:"max_idle_conns"`
	StressReporterTableName string `mapstructure:"stress_reporter_table_name"`
}

type DataConf

type DataConf struct {
	Database   DatabaseConf   `mapstructure:"database"`
	Redis      RedisConf      `mapstructure:"redis"`
	Etcd       EtcdConf       `mapstructure:"etcd"`
	Clickhouse ClickhouseConf `mapstructure:"clickhouse"`
}

type DatabaseConf

type DatabaseConf struct {
	Dsn          string `mapstructure:"dsn"`
	MaxIdleConns int    `mapstructure:"max_idle_conns"`
	MaxOpenConns int    `mapstructure:"max_open_conns"`
}

type EtcdConf

type EtcdConf struct {
	Endpoints string `mapstructure:"endpoints"`
	Username  string `mapstructure:"username"`
	Password  string `mapstructure:"password"`
}

type GrpcConf

type GrpcConf struct {
	Addr string `mapstructure:"addr"`
}

type HttpConf

type HttpConf struct {
	Port       int    `mapstructure:"port"`
	JwtSignKey string `mapstructure:"jwt_sign_key"`
}

type MetricsConf

type MetricsConf struct {
	GrafanaAddr string `mapstructure:"grafana_addr"`
}

type RbacConf

type RbacConf struct {
	RootUsername    string `mapstructure:"root_username"`
	RootName        string `mapstructure:"root_name"`
	RootPassword    string `mapstructure:"root_password"`
	RootId          string `mapstructure:"root_id"`
	UserCacheExp    int64  `mapstructure:"user_cache_exp"`
	DenyDeleteMenu  bool   `mapstructure:"deny_delete_menu"`
	DefaultLoginPwd string `mapstructure:"default_login_pwd"`
	AuthDisable     bool   `mapstructure:"auth_disable"`
}

type RedisConf

type RedisConf struct {
	Type           int    `mapstructure:"type"`
	Addr           string `mapstructure:"addr"`
	Password       string `mapstructure:"password"`
	DB             int    `mapstructure:"db"`
	DialTimeout    int    `mapstructure:"dial_timeout"`
	ReadTimeout    int    `mapstructure:"read_timeout"`
	WriteTimeout   int    `mapstructure:"write_timeout"`
	MinIdleConns   int    `mapstructure:"min_idle_conns"`
	MaxIdleConns   int    `mapstructure:"max_idle_conns"`
	MaxActiveConns int    `mapstructure:"max_active_conns"`
}

type Server

type Server struct {
	Http HttpConf `mapstructure:"http"`
	Grpc GrpcConf `mapstructure:"grpc"`
}

type ServerConf

type ServerConf struct {
	Name       string           `mapstructure:"name"`
	Rbac       RbacConf         `mapstructure:"rbac"`
	Casbin     CasbinConf       `mapstructure:"casbin"`
	Auth       AuthConf         `mapstructure:"auth"`
	Log        log.LoggerConfig `mapstructure:"log"`
	Server     Server           `mapstructure:"server"`
	StressConf WorkerStressConf `mapstructure:"stress_config"`
	Data       DataConf         `mapstructure:"data"`
	Metrics    MetricsConf      `mapstructure:"metrics"`
}

func ReadConfig

func ReadConfig(path string) *ServerConf

ReadConfig read config from path

type WorkerStressConf

type WorkerStressConf struct {
	// pecker max goroutine num every node, testing number before deployment
	MaxGoroutineNum int `mapstructure:"max_goroutine_num"`
	// pecker max rps every node, testing number before deployment
	MaxRpsNum             int   `mapstructure:"max_rps_num"`
	MaxResultChanSize     int32 `mapstructure:"max_result_chan_size"`
	RpsResultChanBlowup   int32 `mapstructure:"rps_result_chan_blowup"`
	MaxTimeoutSecond      int64 `mapstructure:"max_timeout_second"`
	ReportGoroutineNum    int   `mapstructure:"report_goroutine_num"`
	DefaultMaxConnections int   `mapstructure:"default_max_connections"`
	ErrorCutLength        int   `mapstructure:"error_cut_length"`
}

Jump to

Keyboard shortcuts

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