config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Env

type Env struct {
	DB_HOST         string `mapstructure:"DB_HOST"`
	DB_PORT         string `mapstructure:"DB_PORT"`
	DB_USER         string `mapstructure:"DB_USER"`
	DB_PASS         string `mapstructure:"DB_PASS"`
	DB_NAME         string `mapstructure:"DB_NAME"`
	DB_URL          string `mapstructure:"DB_URL"`
	WEB_PORT        string `mapstructure:"WEB_PORT"`
	TIMEOUT         string `mapstructure:"TIMEOUT"`
	ENVIRONMENT     string `mapstructure:"ENVIRONMENT"`
	JWT_TOKEN       string `mapstructure:"JWT_TOKEN"`
	JWT_EXPIRE_HOUR string `mapstructure:"JWT_EXPIRE_HOUR"`
	TOKEN_TYPE      string `mapstructure:"TOKEN_TYPE"`
}

func GetEnv

func GetEnv() (env Env, err error)

GetEnv retrieves the environment configuration from the .env file or environment variables. If the .env file exists, it reads the configuration from it using viper library. Otherwise, it retrieves the configuration from environment variables using viper.AutomaticEnv(). The retrieved configuration is then unmarshaled into the 'env' struct. If any error occurs during the process, it is returned along with the 'env' struct.

Jump to

Keyboard shortcuts

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