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 `default:"local" env:"ENVIRONMENT"` App struct { APP struct { URL string `default:"http://localhost" env:"APP_URL"` Port uint `default:"8080" env:"APP_PORT"` Timezone string `default:"UTC" env:"APP_TIMEZONE"` DebugMode bool `default:"false" env:"APP_DEBUG_MODE"` } DevMode bool `default:"false" env:"DEV"` } Database struct { Mysql struct { Host string `default:"localhost" env:"DB_HOST"` User string `default:"root" env:"DB_USER"` Password string `default:"" env:"DB_PASSWORD"` Port string `default:"3306" env:"DB_PORT"` Name string `env:"DB_NAME"` } Timeout time.Duration `default:"5" env:"DB_TIMEOUT"` DialTimeout time.Duration `default:"5" env:"DB_DIAL_TIMEOUT"` ReadTimeout time.Duration `default:"5" env:"DB_READ_TIMEOUT"` WriteTimeout time.Duration `default:"5" env:"DB_WRITE_TIMEOUT"` } Log struct { Level string `env:"LOG_LEVEL" default:"info"` Format string `env:"LOG_FORMAT" default:"console"` } Authentication struct { Secret string `env:"AUTHENTICATION_SECRET" default:"default_secret"` } }
Config represents application configuration which can also be set via environment variable during runtime.
func LoadConfig ¶
LoadConfig loads the configuration from `.env` file in the same directory as the application and populate the Config accordingly.
Click to show internal directories.
Click to hide internal directories.