config

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2023 License: MIT Imports: 5 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadConfig

func LoadConfig(filename string) (*viper.Viper, error)

Load config file from given path

Types

type AWS

type AWS struct {
	Endpoint      string
	AccessKey     string
	SecretKey     string
	UseSSL        bool
	MinioEndpoint string `yaml:"minio-endpoint,omitempty"`
}

AWS S3

type Config

type Config struct {
	App        map[interface{}]interface{} `yaml:"app"`
	Env        string                      `yaml:"env"`
	Version    string                      `yaml:"version"`
	HTTPServer HTTPServerConfig            `yaml:"http-server,omitempty" mapstructure:"http-server"`

	Logger  Logger  `yaml:"logger"`
	Jaeger  Jaeger  `yaml:"jaeger"`
	Metrics Metrics `yaml:"metrics"`
	Docs    Docs

	RabbitMQ RabbitMQConfig `yaml:"rabbitmq,omitempty"`
	Postgres PostgresConfig `yaml:"postgres,omitempty"`
	Redis    RedisConfig    `yaml:"redis,omitempty"`
	MongoDB  MongoDB        `yaml:"mongodb,omitempty"`
	AWS      AWS            `yaml:"aws,omitempty"`

	Cookie  Cookie  `yaml:"cookie,omitempty"`
	Session Session `yaml:"session,omitempty"`
}

App config struct

func ParseConfig

func ParseConfig(v *viper.Viper) (*Config, error)

Parse config file

type Cookie struct {
	Name     string
	MaxAge   int
	Secure   bool
	HTTPOnly bool
}

Cookie config

type Docs added in v1.1.0

type Docs struct {
	Enable bool
	Title  string
	Prefix string
}

Swagger configuration

type HTTPServerConfig

type HTTPServerConfig struct {
	Port              string
	PprofPort         string
	JwtSecretKey      string
	CookieName        string
	ReadTimeout       time.Duration
	WriteTimeout      time.Duration
	SSL               bool
	CtxDefaultTimeout time.Duration
	CSRF              bool
	Debug             bool
}

HTTP Server config struct

type Jaeger

type Jaeger struct {
	Host        string
	ServiceName string
	LogSpans    bool
}

Jaeger config

type Logger

type Logger struct {
	Development       bool
	DisableCaller     bool
	DisableStacktrace bool
	Encoding          string
	Level             string
}

Logger config

type Metrics

type Metrics struct {
	URL         string
	ServiceName string
}

Metrics config

type MongoDB

type MongoDB struct {
	MongoURI string
}

MongoDB config

type PostgresConfig

type PostgresConfig struct {
	PostgresqlHost     string
	PostgresqlPort     string
	PostgresqlUser     string
	PostgresqlPassword string
	PostgresqlDbname   string
	PostgresqlSSLMode  bool
	PgDriver           string
}

Postgresql config

type RabbitMQConfig added in v1.1.0

type RabbitMQConfig struct {
	Host     string
	Port     string
	User     string
	Password string
	Exchange string
	Queue    string
}

type RedisConfig

type RedisConfig struct {
	RedisAddr      string
	RedisPassword  string
	RedisDB        string
	RedisDefaultdb string
	MinIdleConns   int
	PoolSize       int
	PoolTimeout    int
	Password       string
	DB             int
}

Redis config

type Session

type Session struct {
	Prefix string
	Name   string
	Expire int
}

Session config

Jump to

Keyboard shortcuts

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