Token documentation
fliiiix opened this issue · 3 comments
fliiiix commented
Document in UI and Docs that after getting the token there is no way to get it again so one should take care and store it safely.
feefladder commented
is there really no way to get the token? like is it stored somewhere in the Docker container? I'm having this exact issue now
feefladder commented
found now that they are in the docat-run/db/db.json
file. This is accessible also after claiming!
randombenj commented
@joeperdefloep yes but the value is hashed, you can of course reset the token, here is a script we sometimes use:
import sys
import shutil
import datetime
from tinydb import Query, TinyDB, where
DB_FILE = "config/db.json"
DB = TinyDB(DB_FILE)
def remove_claim(project):
# backup db
shutil.copy(DB_FILE, f"db-{datetime.datetime.now()::%Y-%m-%d-%H-%M}.json")
table = DB.table("claims")
Project = Query()
result = table.search(Project.name == project)
if not result:
print(f"Project {project} does not exist")
else:
id_ = result[0].doc_id
print(f"Remove project {project} with id {id_}")
table.remove(doc_ids=[id_])
if __name__ == "__main__":
if len(sys.argv) < 1:
print(f"Please specify a project")
sys.exit(42)
# run in docker with .venv/bin/python reset_token.py
remove_claim(sys.argv[1])
save it to a reset_token.py
and run sudo reset_token.py PROJECT
.