config

package
v0.0.0-...-b650831 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2023 License: MIT Imports: 2 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 {
	Environment string `mapstructure:"ENVIRONMENT"`

	DBDriver string `mapstructure:"DB_DRIVER"`
	DBSource string `mapstructure:"DB_SOURCE"`

	DBMaxOpenConnections int    `mapstructure:"DB_MAX_OPEN_CONNECTIONS"`
	DBMaxIdleConnections int    `mapstructure:"DB_MAX_IDLE_CONNECTIONS"`
	DBMaxIdleTime        string `mapstructure:"DB_MAX_IDLE_TIME"`
	MigrationURL         string `mapstructure:"MIGRATION_URL"`

	HTTPServerAddress       string        `mapstructure:"HTTP_SERVER_ADDRESS"`
	HTTPServerPort          string        `mapstructure:"HTTP_SERVER_PORT"`
	ReadHeaderTimeout       time.Duration `mapstructure:"READ_HEADER_TIMEOUT"`
	GracefulShutdownTimeout time.Duration `mapstructure:"GRACEFUL_SHUTDOWN_TIMEOUT"`
	RunSwagger              bool          `mapstructure:"RUN_SWAGGER"`
	RequestLog              bool          `mapstructure:"REQUEST_LOG"`

	TokenSymmetricKey    string        `mapstructure:"TOKEN_SYMMETRIC_KEY"`
	AccessTokenDuration  time.Duration `mapstructure:"ACCESS_TOKEN_DURATION"`
	RefreshTokenDuration time.Duration `mapstructure:"REFRESH_TOKEN_DURATION"`

	ScrapeCacheDir string `mapstructure:"SCRAPE_CACHE_DIR"`
}

Config stores all configuration of the application. The values are read by viper from a config file or environment variable.

func LoadConfig

func LoadConfig(path string) (config *Config, err error)

LoadConfig reads configuration from file or environment variables.

Jump to

Keyboard shortcuts

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