config

package
v0.0.0-...-0e611fa Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Logger      Logger
	PostgresSQL PostgresSQL
	Keeper      Keeper
	GRPC        GRPC
	HTTP        HTTP
}

func ParseConfig

func ParseConfig(cfgName string) *Config

type GRPC

type GRPC struct {
	Port              string `env:"GRPC_PORT"  envDefault:":9090"`
	MaxConnectionIdle time.Duration
	Timeout           time.Duration
	MaxConnectionAge  time.Duration
}

GRPC gRPC service config

type HTTP

type HTTP struct {
	Port              string
	Development       bool
	Timeout           time.Duration
	ReadTimeout       time.Duration
	WriteTimeout      time.Duration
	MaxConnectionIdle time.Duration
	MaxConnectionAge  time.Duration
}

HTTP server config

type Keeper

type Keeper struct {
	JwtSecret     string        `env:"JWT_SECRET"  envDefault:"jwt_secret"`
	JwtDuration   time.Duration `env:"JWT_DURATION"  envDefault:"5h"`
	CryptSecret   string        `env:"CRYPT_SECRET"  envDefault:"passphrasewhichneedstobe32bytes!"`
	FileStorePath string        `env:"FILE_STORE_PATH"  envDefault:"/tmp/"`
}

type Logger

type Logger struct {
	Level    string `env:"LOGGER_LEVEL"  envDefault:"info"`
	Debug    bool   `env:"LOGGER_DEBUG"  envDefault:"1"`
	Encoding string `env:"LOGGER_ENCODING"  envDefault:"console"`
}

type PostgresSQL

type PostgresSQL struct {
	Address         string        `env:"PG_ADDR" envDefault:"127.0.0.1:5432"`
	User            string        `env:"PG_USER" envDefault:"fd239"`
	Password        string        `env:"PG_PWD" envDefault:"fd239"`
	DatabaseName    string        `env:"PG_DB" envDefault:"gopher_keeper_db"`
	MaxOpenConns    int           `env:"PG_MAX_OPEN_CONNS" envDefault:"50"`
	MaxIdleConns    int           `env:"PG_MAX_IDLE_CONNS" envDefault:"5"`
	ConnMaxLifetime time.Duration `env:"PG_CONN_MAX_LIFETIME" envDefault:"5m"`
}

PostgresSQL config

Jump to

Keyboard shortcuts

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