config

package
v0.0.0-...-ce453ac Latest Latest
Warning

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

Go to latest
Published: May 25, 2024 License: Apache-2.0 Imports: 6 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 {
	DBConfig
	HTTPConfig
	LoggerConfig
	SwaggerConfig
	StorageHandler string `env:"STORAGE_HANDLER_URL" env-default:"http://0.0.0.0:3391"`
}

func GetConfig

func GetConfig() *Config

func (Config) ToAppConfig

func (c Config) ToAppConfig() server.AppConfig

func (Config) ToDBConfig

func (c Config) ToDBConfig() postgresql.DBConfig

func (Config) ToLoggerConfig

func (c Config) ToLoggerConfig() logger.LoggerConfig

type DBConfig

type DBConfig struct {
	DBPort                string `env:"DB_PORT" env-required:"true"`
	DBHost                string `env:"DB_HOST" env-required:"true"`
	DBName                string `env:"DB_NAME" env-required:"true"`
	DBPassword            string `env:"DB_PASSWORD" env-required:"true"`
	DBUsername            string `env:"DB_USERNAME" env-required:"true"`
	MaxConnectionAttempts int    `env:"MAX_ATTEMPTS" env-default:"10"`

	AutoMigrate   bool   `env:"AUTO_MIGRATE" env-default:"true"`
	MigrationsDir string `env:"MIGRATIONS_DIR" env-default:"migrations"`
}

type HTTPConfig

type HTTPConfig struct {
	Port                    string `env:"PORT"  env-required:"true"`
	Host                    string `env:"HOST"  env-required:"true"`
	ReadTimeoutSeconds      int    `env:"READ_TIMEOUT_SEC" env-default:"0"`
	WriteTimeoutSeconds     int    `env:"WRITE_TIMEOUT_SEC" env-default:"0"`
	GracefulShutdownTimeout uint   `env:"GRACEFUL_SHUTDOWN_TIMEOUT_SEC" env-default:"5"`
}

type LoggerConfig

type LoggerConfig struct {
	IsProduction bool `env:"IS_PRODUCTION" env-default:"true"`
}

type SwaggerConfig

type SwaggerConfig struct {
	IsEnableSwagger bool   `env:"IS_ENABLE_SWAGGER" env-default:"true"`
	SwaggerURL      string `env:"SWAGGER_URL"`
}

Jump to

Keyboard shortcuts

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