You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
658 B
Go
36 lines
658 B
Go
package settings
|
|
|
|
import (
|
|
"os"
|
|
|
|
"github.com/joho/godotenv"
|
|
"github.com/kelseyhightower/envconfig"
|
|
)
|
|
|
|
// App defines the Application Settings structure
|
|
type App struct {
|
|
PostgresURL string
|
|
|
|
TemporalHost string
|
|
TemporalNS string
|
|
}
|
|
|
|
// LoadSettings will pull the application config from the environment, or from
|
|
// a .env file
|
|
func LoadSettings() (config *App, err error) {
|
|
config = &App{}
|
|
|
|
if err = godotenv.Load(); err != nil {
|
|
// We don't care if an .env is missing, it will be in prod.
|
|
if !os.IsNotExist(err) {
|
|
return nil, err
|
|
}
|
|
}
|
|
|
|
if err = envconfig.Process("INATOR", config); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return config, nil
|
|
}
|