~netlandish/gobwebs

deb6631625b5cfe5cd3273f2b88c978c4478608a — Peter Sanchez 2 years ago ac18465
Adding Environment config variable
1 files changed, 6 insertions(+), 0 deletions(-)

M config/config.go
M config/config.go => config/config.go +6 -0
@@ 27,6 27,7 @@ type Config struct {
	EmailAdminErrors bool
	DefaultFromEmail string
	DefaultLang      string
	Environment      string

	Scheme string
	Domain string


@@ 58,6 59,7 @@ func LoadConfig(fname string) (*Config, error) {
		EmailAdminErrors: true,
		DefaultFromEmail: "gobwebs@localhost",
		DefaultLang:      "en",
		Environment:      "development",
		Scheme:           "http",
		Domain:           "127.0.0.1:8000",
	}


@@ 133,6 135,10 @@ func LoadConfig(fname string) (*Config, error) {
		conf.Domain = val
	}

	if val, ok := file.Get("gobwebs", "environment"); ok {
		conf.Environment = val
	}

	conf.DbConnString, ok = file.Get("database", "connection-string")
	if !ok {
		return nil, fmt.Errorf("database:connection-string unset")