Introduce settings.json to store custom sources

This commit is contained in:
nemunaire 2024-10-01 19:10:45 +02:00
commit ded6ef6095
6 changed files with 143 additions and 23 deletions

View file

@ -9,6 +9,7 @@ func (c *Config) declareFlags() {
flag.StringVar(&c.BaseURL, "baseurl", c.BaseURL, "URL prepended to each URL")
flag.StringVar(&c.Bind, "bind", c.Bind, "Bind port/socket")
flag.StringVar(&c.DevProxy, "dev", c.DevProxy, "Use ui directory instead of embedded assets")
flag.StringVar(&c.SettingsPath, "settings-file", c.SettingsPath, "Path to settings.json file")
// Others flags are declared in some other files when they need specials configurations
}
@ -16,7 +17,8 @@ func (c *Config) declareFlags() {
func Consolidated() (cfg *Config, err error) {
// Define defaults options
cfg = &Config{
Bind: "127.0.0.1:8080",
Bind: "127.0.0.1:8080",
SettingsPath: "settings.json",
}
cfg.declareFlags()

View file

@ -6,9 +6,10 @@ import (
)
type Config struct {
DevProxy string
Bind string
BaseURL string
DevProxy string
Bind string
BaseURL string
SettingsPath string
}
// parseLine treats a config line and place the read value in the variable