node-api/common/config.go
2021-01-08 22:37:38 +01:00

25 lines
469 B
Go

package common
import (
"log"
"github.com/kelseyhightower/envconfig"
)
// Config keeps info about configuration of this daemon
type Config struct {
AppsPath string `envconfig:"APPS_PATH" default:"/srv"` // Where applications are located
}
// GetConfig return configuration created based on environment variables
func GetConfig() *Config {
var config Config
err := envconfig.Process("", &config)
if err != nil {
log.Fatal(err.Error())
}
return &config
}