1
0
mirror of https://github.com/hrfee/jfa-go.git synced 2024-11-05 01:40:10 +00:00
jfa-go/fixconfig/fixconfig.py
Harvey Tindall 024c0b56aa Display settings with hacky solution to retain order
Python utility included to convert config-base.json into a new version
which includes lists that define the order settings should be displayed.
admin.js edited to recognize this.
2020-07-31 16:09:30 +01:00

22 lines
548 B
Python

import json
with open('config-base.json', 'r') as f:
config = json.load(f)
newconfig = {"order": []}
for sect in config:
newconfig["order"].append(sect)
newconfig[sect] = {}
newconfig[sect]["order"] = []
newconfig[sect]["meta"] = config[sect]["meta"]
for setting in config[sect]:
if setting != "meta":
newconfig[sect]["order"].append(setting)
newconfig[sect][setting] = config[sect][setting]
with open('ordered-config-base.json', 'w') as f:
f.write(json.dumps(newconfig, indent=4))