31 lines
482 B
Go
31 lines
482 B
Go
package services
|
|
|
|
import (
|
|
"log"
|
|
"os"
|
|
|
|
"github.com/joho/godotenv"
|
|
)
|
|
|
|
type EnvConfig struct {
|
|
ApiServerUri string
|
|
SharedApiSecret string
|
|
CookieSecret string
|
|
}
|
|
|
|
func NewEnvConfig() EnvConfig {
|
|
_, err := os.Stat(".env")
|
|
if err == nil {
|
|
err = godotenv.Load()
|
|
if err != nil {
|
|
log.Println(err)
|
|
}
|
|
}
|
|
|
|
return EnvConfig{
|
|
ApiServerUri: os.Getenv("ApiServerUri"),
|
|
SharedApiSecret: os.Getenv("SharedApiSecret"),
|
|
CookieSecret: os.Getenv("CookieSecret"),
|
|
}
|
|
}
|