31 lines
481 B
Go
31 lines
481 B
Go
package config
|
|
|
|
import (
|
|
"os"
|
|
"strconv"
|
|
)
|
|
|
|
var (
|
|
config *Config
|
|
)
|
|
|
|
type Config struct {
|
|
ApplicationName string
|
|
ApplicationPort int64
|
|
LoggingLevel string
|
|
PostgresDSN string
|
|
}
|
|
|
|
func GetConfig() *Config {
|
|
port, _ := strconv.ParseInt(os.Getenv("SERVING_PORT"), 10, 64)
|
|
|
|
config = &Config{
|
|
ApplicationName: os.Getenv("APP_NAME"),
|
|
ApplicationPort: port,
|
|
LoggingLevel: os.Getenv("LOGGING_LEVEL"),
|
|
PostgresDSN: os.Getenv("POSTGRES_DSN"),
|
|
}
|
|
|
|
return config
|
|
}
|