v25/config.py
timotheyca ad479a615a DB rework
.check model
config
2020-08-06 01:18:16 +03:00

28 lines
505 B
Python

import json
from typing import Dict, Any, Union
from v25.storage.dbstorage import DBStorage
_d_type = Dict[Any, Union[str, Dict[str, Any]]]
def get_config() -> _d_type:
with open('config.json') as f:
return json.load(f)
def from_config(d: _d_type):
storage = DBStorage(d["db"])
subjects = d["subjects"]
for subject in subjects:
storage.ssssj(subject, json.dumps(subjects[subject]))
def main():
from_config(get_config())
if __name__ == '__main__':
main()