config

package
v0.7.4 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDbConfiguration

func GetDbConfiguration() string

func GetRunServerConfig

func GetRunServerConfig() string

func SetupConfig

func SetupConfig(configPath string) error

Types

type Configuration

type Configuration struct {
	Server   ServerConfiguration   `mapstructure:",squash"`
	Database DatabaseConfiguration `mapstructure:",squash"`
}
var (
	Cfg *Configuration
)

func GetCfg

func GetCfg() *Configuration

type DatabaseConfiguration

type DatabaseConfiguration struct {
	Name           string `mapstructure:"DB_NAME" validate:"required"`
	User           string `mapstructure:"DB_USER" validate:"required"`
	Pass           string `mapstructure:"DB_PASS" validate:"required"`
	Host           string `mapstructure:"DB_HOST"`
	Port           string `mapstructure:"DB_PORT"`
	SslMode        string `mapstructure:"DB_SSL_MODE"`
	LogMode        bool   `mapstructure:"DB_LOG_MODE"`
	MigrationsPath string `mapstructure:"MIGRATIONS_PATH"`
}

type ServerConfiguration

type ServerConfiguration struct {
	IsProduction         bool   `mapstructure:"IS_PRODUCTION"`
	IsEnableProm         bool   `mapstructure:"IS_ENABLE_PROM"`
	IsDebug              bool   `mapstructure:"IS_DEBUG"`
	AllowedHosts         string `mapstructure:"ALLOWED_HOSTS"`
	AllowedOrigins       string `mapstructure:"ALLOWED_ORIGINS"`
	Domain               string `mapstructure:"DOMAIN" validate:"required"`
	Host                 string `mapstructure:"SERVER_HOST"`
	Port                 string `mapstructure:"SERVER_PORT"`
	Timezone             string `mapstructure:"SERVER_TIMEZONE"`
	JwtAccessSecret      string `mapstructure:"JWT_ACCESS_SECRET" validate:"required"`
	JwtAccessExpTime     string `mapstructure:"JWT_ACCESS_EXP_TIME" validate:"required"`
	JwtRefreshSecret     string `mapstructure:"JWT_REFRESH_SECRET" validate:"required"`
	JwtRefreshExpTime    string `mapstructure:"JWT_REFRESH_EXP_TIME" validate:"required"`
	LimitCountPerRequest int64  `mapstructure:"LIMIT_COUNT_PER_REQUEST"`
}

Jump to

Keyboard shortcuts

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