attempt at using a config struct instead of the ini library

Added script to convert config-base.json into a go struct, so that
access to config values and metadata could be unified and simpler. It
probably won't see any actual use though as mapping the ini into it is
painful.
This commit is contained in:
Harvey Tindall
2020-08-15 22:07:48 +01:00
parent 39bf3ad7f1
commit 19bd31d968
5 changed files with 634 additions and 3 deletions
+26
View File
@@ -6,6 +6,32 @@ import (
"strconv"
)
/*var DeCamel ini.NameMapper = func(raw string) string {
out := make([]rune, 0, len(raw))
upper := 0
for _, c := range raw {
if unicode.IsUpper(c) {
upper++
}
if upper == 2 {
out = append(out, '_')
upper = 0
}
out = append(out, unicode.ToLower(c))
}
return string(out)
}
func (ctx *appContext) loadDefaults() (err error) {
var cfb []byte
cfb, err = ioutil.ReadFile(ctx.configBase_path)
if err != nil {
return
}
json.Unmarshal(cfb, ctx.defaults)
return
}*/
func (ctx *appContext) loadConfig() error {
var err error
ctx.config, err = ini.Load(ctx.config_path)