config

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: May 22, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package config manages the configuration of IAM platform.

Index

Constants

View Source
const (
	DefaultGRPCAddr       = "0.0.0.0:8001"
	DefaultGRPCMaxMsgSize = 4 * 1024 * 1024
)
View Source
const (
	DefaultHTTPMode        = "release"
	DefaultHTTPAddr        = "0.0.0.0:8000"
	DefaultHTTPPingTimeout = time.Duration(10 * time.Second)
	DefaultHealthz         = true
	DefaultMetrics         = false
	DefaultProfiling       = false
)
View Source
const (
	DefaultJWTTimeout    = time.Duration(24 * time.Second)
	DefaultJWTMaxRefresh = time.Duration(24 * time.Second)
)
View Source
const (
	DefaultMysqlAddr            = "127.0.0.1:3306"
	DefaultMysqlMaxIdleConns    = 100
	DefaultMysqlMaxOpenConns    = 100
	DefaultMysqlMaxConnLifeTime = time.Duration(10 * time.Second)
)

Variables

View Source
var (
	EnvPrefix          = "IAM"
	DefaultConfigPaths = []string{".", "./configs", "/etc/iam"}
)

Functions

This section is empty.

Types

type Config added in v0.1.5

type Config struct {
	HTTPOpts  *HTTPOptions  `mapstructure:"http"`
	GRPCOpts  *GRPCOptions  `mapstructure:"grpc"`
	JWTOpts   *JWTOptions   `mapstructure:"jwt"`
	MysqlOpts *MysqlOptions `mapstructure:"mysql"`
	RedisOpts *RedisOptions `mapstructure:"redis"`
	// contains filtered or unexported fields
}

Config defines the structure of the iam configuration.

func NewConfig added in v0.1.5

func NewConfig(cfgPath, appName string) (*Config, error)

NewConfig builds a config from cfgPath or from <DefaultConfigPaths>/<appName>.yaml.

type GRPCOptions added in v0.1.5

type GRPCOptions struct {
	Addr       string
	MaxMsgSize int `mapstructure:"max-msg-size"`
}

GRPCOptions defines options for building a GRPCServer.

func DefaultGRPCOptions added in v0.1.5

func DefaultGRPCOptions() *GRPCOptions

DefaultGRPCOptions news an GRPCOptions.

type HTTPOptions added in v0.1.5

type HTTPOptions struct {
	Mode        string
	Addr        string
	Middlewares []string
	PingTimeout time.Duration `mapstructure:"ping-timeout"`
	Healthz     bool
	Metrics     bool
	Profiling   bool
}

HTTPOptions defines options for building an HTTPServer.

func DefaultHTTPOptions added in v0.1.5

func DefaultHTTPOptions() *HTTPOptions

DefaultHTTPOptions news an HTTPOptions.

type JWTOptions added in v0.1.5

type JWTOptions struct {
	Key        string
	Timeout    time.Duration
	MaxRefresh time.Duration `mapstructure:"max-refresh"`
}

JWTOptions defines options for building a GinJWTMiddleware.

func DefaultJWTOptions added in v0.1.5

func DefaultJWTOptions() *JWTOptions

DefaultJWTOptions news a JWTOptions.

type MysqlOptions added in v0.1.5

type MysqlOptions struct {
	Addr            string
	Username        string
	Password        string
	Database        string
	MaxIdleConns    int           `mapstructure:"max-idle-conns"`
	MaxOpenConns    int           `mapstructure:"max-open-conns"`
	MaxConnLifeTime time.Duration `mapstructure:"max-connection-life-time"`
}

MysqlOptions defines options for building a mysql instance.

func DefaultMysqlOptions added in v0.1.5

func DefaultMysqlOptions() *MysqlOptions

DefaultMysqlOptions news an MySQLOptions.

type RedisOptions added in v0.1.5

type RedisOptions struct {
	Addrs    []string
	Password string
	Database int
}

RedisOptions defines options for building a redis client.

func DefaultRedisOptions added in v0.1.5

func DefaultRedisOptions() *RedisOptions

DefaultRedisOptions news a RedisOptions.

Jump to

Keyboard shortcuts

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