mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2025-03-18 20:39:46 +00:00
Fix migration to run
This commit is contained in:
parent
d7fe7097e6
commit
fe86382819
2 changed files with 4 additions and 2 deletions
|
@ -1,7 +1,8 @@
|
||||||
from selfprivacy_api.utils import ReadUserData
|
from selfprivacy_api.utils import ReadUserData
|
||||||
from selfprivacy_api.migrations.fix_nixos_config_branch import FixNixosConfigBranch
|
from selfprivacy_api.migrations.fix_nixos_config_branch import FixNixosConfigBranch
|
||||||
|
from selfprivacy_api.migrations.create_tokens_json import CreateTokensJson
|
||||||
|
|
||||||
migrations = [FixNixosConfigBranch()]
|
migrations = [FixNixosConfigBranch(), CreateTokensJson()]
|
||||||
|
|
||||||
|
|
||||||
def run_migrations():
|
def run_migrations():
|
||||||
|
|
|
@ -35,7 +35,8 @@ class CreateTokensJson(Migration):
|
||||||
|
|
||||||
def migrate(self):
|
def migrate(self):
|
||||||
try:
|
try:
|
||||||
with ReadUserData(USERDATA_FILE) as userdata:
|
print(f"Creating tokens.json file at {TOKENS_FILE}")
|
||||||
|
with ReadUserData() as userdata:
|
||||||
token = userdata["api"]["token"]
|
token = userdata["api"]["token"]
|
||||||
# Touch tokens.json with 0600 permissions
|
# Touch tokens.json with 0600 permissions
|
||||||
Path(TOKENS_FILE).touch(mode=0o600)
|
Path(TOKENS_FILE).touch(mode=0o600)
|
||||||
|
|
Loading…
Add table
Reference in a new issue