Fallback pour localStorage et config simplifiée de l'adresse publique de l'app client

This commit is contained in:
2020-06-16 18:02:28 -04:00
parent 47020f7beb
commit e0b59de77c
5 changed files with 29 additions and 10 deletions

View File

@ -19,15 +19,13 @@ type Config struct {
// HTTPConfig is the configuration part which defines HTTP related params
type HTTPConfig struct {
BaseURL string `yaml:"baseurl" env:"GUESSTIMATE_BASE_URL"`
Address string `yaml:"address" env:"GUESSTIMATE_HTTP_ADDRESS"`
PublicDir string `yaml:"publicDir" env:"GUESSTIMATE_PUBLIC_DIR"`
}
// ClientConfig is the configuration part which defines the client app related params
type ClientConfig struct {
BaseURL string `yaml:"baseurl" env:"GUESSTIMATE_CLIENT_BASE_URL"`
Address string `yaml:"address" env:"GUESSTIMATE_CLIENT_HTTP_ADDRESS"`
PublicBaseURL string `yaml:"publicbaseurl" env:"GUESSTIMATE_CLIENT_PUBLIC_BASE_URL"`
}
// DataConfig is the configuration part which defines data related params
@ -70,13 +68,11 @@ func NewDumpDefault() *Config {
func NewDefault() *Config {
return &Config{
HTTP: HTTPConfig{
BaseURL: "localhost",
Address: ":8081",
PublicDir: "public",
},
Client: ClientConfig{
BaseURL: "localhost",
Address: ":8080",
PublicBaseURL: "http://localhost:8080",
},
Data: DataConfig{
Path: "guesstimate.db",