config

package
v0.0.0-...-3d95c69 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

type Builder struct {
	// contains filtered or unexported fields
}

Builder build configuration with some options.

func NewBuilder

func NewBuilder() *Builder

NewBuilder return new builder instance.

func (*Builder) AddConfigFile

func (builder *Builder) AddConfigFile(filePath string, optional bool) *Builder

AddConfigFile read config file from filePath.

func (*Builder) BindEnvs

func (builder *Builder) BindEnvs(prefix string) *Builder

BindEnvs bind environment variables.

func (*Builder) Build

func (builder *Builder) Build() (Configuration, error)

Build return new configuration instance.

type Configuration

type Configuration struct {
	Addr     string         `mapstructure:"addr"`
	Postgres PostgresConfig `mapstructure:"postgres"`
	Jwt      JwtConfig      `mapstructure:"jwt"`
	Redis    RedisConfig    `mapstructure:"redis"`
}

Configuration is config type.

type JwtConfig

type JwtConfig struct {
	SecretKey           string `mapstructure:"secret_key"`
	AccessExpiresInSec  int64  `mapstructure:"access_expires_sec"`
	RefreshExpiresInSec int64  `mapstructure:"refresh_expires_sec"`
}

JwtConfig is jwt config

type PostgresConfig

type PostgresConfig struct {
	Driver   string `mapstructure:"driver"`
	Host     string `mapstructure:"host"`
	Port     string `mapstructure:"port"`
	User     string `mapstructure:"user"`
	Name     string `mapstructure:"name"`
	Password string `mapstructure:"password"`
}

PostgresConfig is postgres config

type RedisConfig

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

RedisConfig is redis config

Jump to

Keyboard shortcuts

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