Enable API by default and automatically generate API key on first server startup
This commit is contained in:
1 parent
d60ab8cd9e
commit
d49cd209e1
2 files changed
+11
-2
No files matched your search
@@ -129,8 +129,8 @@ default_settings = {
|
||||
"subscriptions": []
|
||||
},
|
||||
"api": {
|
||||
"enabled": False,
|
||||
"key": ''.join('%02X' % ord(z) for z in uuid.uuid4().bytes)
|
||||
"enabled": True,
|
||||
"key": None
|
||||
},
|
||||
"terminalFilters": [
|
||||
{ "name": "Suppress M105 requests/responses", "regex": "(Send: M105)|(Recv: ok T\d*:)" },
|
||||
@@ -171,6 +171,10 @@ class Settings(object):
|
||||
self._configfile = os.path.join(self.settings_dir, "config.yaml")
|
||||
self.load(migrate=True)
|
||||
|
||||
if self.get(["api", "key"]) is None:
|
||||
self.set(["api", "key"], ''.join('%02X' % ord(z) for z in uuid.uuid4().bytes))
|
||||
self.save(force=True)
|
||||
|
||||
def _init_settings_dir(self, basedir):
|
||||
if basedir is not None:
|
||||
self.settings_dir = basedir
|
||||
|
||||
Reference in new issue
Block a user