28 lines
505 B
Python
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()
|