orion/cmd/server/config.go

29 lines
534 B
Go
Raw Normal View History

2018-09-17 14:17:54 +02:00
package main
import (
"github.com/caarlos0/env"
)
type config struct {
2018-12-06 22:12:32 +01:00
HTTPHost string `env:"ORION_HTTP_HOST"`
HTTPPort string `env:"ORION_HTTP_PORT"`
TemplateDir string `env:"ORION_TEMPLATE_DIR"`
AssetDir string `env:"ORION_ASSET_DIR"`
2018-09-17 14:17:54 +02:00
}
func overwriteFromEnv(conf *config) error {
if err := env.Parse(conf); err != nil {
return err
}
return nil
}
func newDefaultConfig() *config {
return &config{
2018-12-06 22:12:32 +01:00
HTTPHost: "0.0.0.0",
HTTPPort: "8888",
TemplateDir: "./templates",
AssetDir: "./assets",
2018-09-17 14:17:54 +02:00
}
}