29 lines
534 B
Go
29 lines
534 B
Go
package main
|
|
|
|
import (
|
|
"github.com/caarlos0/env"
|
|
)
|
|
|
|
type config struct {
|
|
HTTPHost string `env:"ORION_HTTP_HOST"`
|
|
HTTPPort string `env:"ORION_HTTP_PORT"`
|
|
TemplateDir string `env:"ORION_TEMPLATE_DIR"`
|
|
AssetDir string `env:"ORION_ASSET_DIR"`
|
|
}
|
|
|
|
func overwriteFromEnv(conf *config) error {
|
|
if err := env.Parse(conf); err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func newDefaultConfig() *config {
|
|
return &config{
|
|
HTTPHost: "0.0.0.0",
|
|
HTTPPort: "8888",
|
|
TemplateDir: "./templates",
|
|
AssetDir: "./assets",
|
|
}
|
|
}
|