dolar/config/config.go
maximo tejeda 4b60ebc7a7
All checks were successful
dev test / test (push) Successful in 17s
dev test / vulnCheck (push) Successful in 30s
dev test / Ci-Lint (push) Successful in 19s
${{ github.actor }} executed Build Push Prod / build (push) Successful in 4m24s
${{ github.actor }} executed Build Push Prod / deploy (push) Successful in 18s
FIRST commit
2024-12-02 16:07:48 -04:00

36 lines
640 B
Go

package config
import (
"log"
"os"
"strconv"
)
func GetEnv() string {
return getEnvironmentValue("ENV")
}
func GetDataSourceURL() string {
return getEnvironmentValue("DATA_SOURCE_URL")
}
func GetApplicationPort() int {
portStr := getEnvironmentValue("APPLICATION_PORT")
port, err := strconv.Atoi(portStr)
if err != nil {
log.Fatalf("port: %s is invalid", portStr)
}
return port
}
func GetNatsServiceUrl() string {
return getEnvironmentValue("NATS_SERVICE_URL")
}
func getEnvironmentValue(key string) string {
if os.Getenv(key) == "" {
log.Fatalf("%s environment variable is missing.", key)
}
return os.Getenv(key)
}