config

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2020 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//LOCALHOST ...11
	LOCALHOST = "${LOCALHOST}"
)

Variables

This section is empty.

Functions

func EnvVar

func EnvVar(v string) string

EnvVar environment variable

Types

type AppConfig

type AppConfig struct {
	DB       *DBConfig       `yaml:"db" json:"db"`
	Redis    *RedisConfig    `yaml:"redis" json:"redis"`
	Jaeger   *JaegerConfig   `yaml:"jaeger" json:"jaeger"`
	Rabbitmq *RabbitmqConfig `yaml:"rabbitmq" json:"rabbitmq"`
}

AppConfig ...

func NewAppConfig

func NewAppConfig(df *DefaultConfig, af *AppConfig) *AppConfig

NewAppConfig return new app config from default config and old app config.

type DBConfig

type DBConfig struct {
	Server       string `yaml:"server" json:"server"`
	Driver       string `yaml:"driver" json:"driver"`
	Host         string `yaml:"host" json:"host"`
	Port         uint   `yaml:"port" json:"port"`
	User         string `yaml:"user" json:"user"`
	Password     string `yaml:"password" json:"password"`
	Name         string `yaml:"name" json:"name"`
	MaxIdleConns uint   `yaml:"max_idle_conns" json:"max_idle_conns"`
	MaxOpenConns uint   `yaml:"max_open_conns" json:"max_open_conns"`
	EnableLog    bool   `yaml:"enable_log" json:"enable_log"`
}

DBConfig config of relational database

type DefaultConfig

type DefaultConfig struct {
	DB            map[string]*DBConfig       `yaml:"db" json:"db"`
	Redis         map[string]*RedisConfig    `yaml:"redis" json:"redis"`
	Jaeger        map[string]*JaegerConfig   `yaml:"jaeger" json:"jaeger"`
	Rabbitmq      map[string]*RabbitmqConfig `yaml:"rabbitmq" json:"rabbitmq"`
	ExpressConfig *ExpressConfig             `yaml:"express" json:"express"`
	SMSConfig     *SMSConfig                 `yaml:"sms" json:"sms"`
}

DefaultConfig ...

type ElasticConfig

type ElasticConfig struct {
	URLs []string `yaml:"urls" json:"urls"`
}

ElasticConfig config of elasticsearch brokers

type ExpressConfig

type ExpressConfig struct {
	Key      string `yaml:"key" json:"key"`
	Customer string `yaml:"customer" json:"customer"`
	Secret   string `yaml:"secret" json:"secret"`
}

ExpressConfig ...

type JaegerConfig

type JaegerConfig struct {
	Server      string    `yaml:"server" json:"server"`
	ServiceName string    `yaml:"service_name" json:"service_name"`
	Sampler     *Sampler  `yaml:"sampler" json:"sampler"`
	Reporter    *Reporter `yaml:"reporter" json:"reporter"`
}

JaegerConfig config of jeager

type RabbitmqConfig

type RabbitmqConfig struct {
	Server   string `yaml:"server" json:"server"`
	Host     string `yaml:"host" json:"host"`
	Port     uint   `yaml:"port" json:"port"`
	User     string `yaml:"user" json:"user"`
	Password string `yaml:"password" json:"password"`
}

RabbitmqConfig config of rabbitmq

type RedisConfig

type RedisConfig struct {
	Server   string `yaml:"server" json:"server"`
	Host     string `yaml:"host" json:"host"`
	Name     int    `yaml:"name" json:"name"`
	Password string `yaml:"password" json:"password"`
}

RedisConfig config of redis

type Reporter

type Reporter struct {
	LogSpans      bool          `yaml:"log_spans" json:"log_spans"`
	HostPort      string        `yaml:"host_port" json:"host_port"`
	FlushInterval time.Duration `yaml:"flush_interval" json:"flush_interval"`
	QueueSize     int           `yaml:"queue_size" json:"queue_size"`
}

Reporter config of jaeger reporter

type SMSConfig

type SMSConfig struct {
	Product        string   `yaml:"product" json:"product"`
	AppKey         string   `yaml:"app_key" json:"app_key"`
	AppSecret      string   `yaml:"app_secret" json:"app_secret"`
	SignName       string   `yaml:"sign_name" json:"sign_name"`
	DailySendLimit int      `yaml:"daily_send_limit" json:"daily_send_limit"`
	Templates      []string `yaml:"templates" json:"templates"`
}

SMSConfig 短信配置结构

type Sampler

type Sampler struct {
	Type            string        `yaml:"type" json:"type"`
	Param           int           `yaml:"param" json:"param"`
	HostPort        string        `yaml:"host_port" json:"host_port"`
	RefreshInterval time.Duration `yaml:"refresh_interval" json:"refresh_interval"`
}

Sampler config of jaeger sampler

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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