Initial commit

This commit is contained in:
nemunaire 2023-11-12 21:25:57 +01:00
commit 5d0a210e6d
16 changed files with 998 additions and 0 deletions

28
config/config.go Normal file
View file

@ -0,0 +1,28 @@
package config
import (
"flag"
"strings"
)
type Config struct {
DevProxy string
Bind string
BaseURL string
}
// parseLine treats a config line and place the read value in the variable
// declared to the corresponding flag.
func (c *Config) parseLine(line string) (err error) {
fields := strings.SplitN(line, "=", 2)
orig_key := strings.TrimSpace(fields[0])
value := strings.TrimSpace(fields[1])
key := strings.TrimPrefix(orig_key, "HATHORIS_")
key = strings.Replace(key, "_", "-", -1)
key = strings.ToLower(key)
err = flag.Set(key, value)
return
}