config

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2023 License: MIT Imports: 5 Imported by: 3 modules, 3 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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 {
	Logger  Logger  `yaml:"logger"`
	Jaeger  Jaeger  `yaml:"jaeger"`
	Metrics Metrics `yaml:"metrics"`

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

	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 HTTPServerConfig

type HTTPServerConfig struct {
	AppVersion        string
	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 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