Skip to content

Commit

Permalink
feat/admin_update_backend_config (#66)
Browse files Browse the repository at this point in the history
  • Loading branch information
JarbasAl authored Jun 8, 2023
1 parent d9b41e6 commit 9838592
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,13 @@ configure backend by editing/creating ```~/.config/mycroft/mycroft.conf```
},

"server": {
"admin_key": "",
"port": 6712,
"database": "sqlite:////home/user/.local/share/ovos_backend.db",
"skip_auth": false,
"geolocate": true,
"override_location": false,
"skip_auth": false,
"api_version": "v1"
"version": "v1"
},

"listener": {
Expand All @@ -82,7 +83,6 @@ configure backend by editing/creating ```~/.config/mycroft/mycroft.conf```
}
}


}
```

Expand Down
13 changes: 13 additions & 0 deletions ovos_local_backend/backend/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,22 @@
from ovos_local_backend.utils import generate_code
from ovos_local_backend.utils import nice_json
from ovos_local_backend.utils.geolocate import get_request_location
from ovos_config import LocalConf, USER_CONFIG, Configuration


def get_admin_routes(app):

@app.route("/" + API_VERSION + "/admin/config", methods=['POST', 'GET'])
@requires_admin
@noindex
def update_config():
if flask.request.method == 'GET':
return nice_json(Configuration())
cfg = LocalConf(USER_CONFIG)
cfg.merge(flask.request.json["config"])
cfg.store()
return nice_json(cfg)

@app.route("/" + API_VERSION + "/admin/<uuid>/pair", methods=['GET'])
@requires_admin
@noindex
Expand Down

0 comments on commit 9838592

Please sign in to comment.