dump updated config to a yaml file

This commit is contained in:
Saba
2021-11-28 12:26:07 -05:00
parent 5b80b87379
commit 8837b02de6
2 changed files with 22 additions and 31 deletions

View File

@@ -37,8 +37,9 @@ def config():
@app.post('/config')
async def config(updated_config: FullConfig):
to_yaml = yaml.dump(updated_config.json())
print(to_yaml)
with open('config.yml', 'w') as outfile:
yaml.dump(yaml.safe_load(updated_config.json()), outfile)
outfile.close()
return updated_config
@app.get('/search')