mirror of
https://github.com/hrfee/jfa-go.git
synced 2024-11-09 20:00:12 +00:00
Harvey Tindall
f063b970b4
config-base.yaml is almost identical to json version, except there's no "order" field, as "sections" and "settings" fields are now lists themselves and so Go can parse the correct order. As such, removed enumerate_config.py. Also, rewrote scripts/generate_ini.py in Go as scripts/ini/. Config structure in Go form is now in common/config.go, and is used by jfa-go and the ini script. app.configBase is now untouched once read from config-base.yaml, and instead copied to and patched in app.patchedConfig. Patching occurs at program start and config modification, so GetConfig is now just a couple of lines. Discord role patching still occurs in GetConfig, as the available roles can change regularly. Also added new "Disabled" field to sections, to avoid the nightmare of deleting from an array. |
||
---|---|---|
.. | ||
config-base.yaml | ||
config-json-to-new-yaml.py | ||
gen-rough-schema.py | ||
README.md |
fixconfig
Python's json
library retains the order of data in a JSON file, which meant settings sent to the web page would be in the right order. Go's encoding/json
and maps do not retain order, so enumerate/enumerate_config.py
opens the json file, and for each section, adds an "order" array which tells the web page in which order to display settings.
Specify the input and output files with -i
and -o
respectively.