From c1d8ad88a43a87ac7ecdf7f324750252a9e6505b Mon Sep 17 00:00:00 2001 From: erdgeist Date: Mon, 6 Jan 2025 04:03:17 +0100 Subject: Let versions reside under var/ --- fullnarp.py | 8 ++++---- var/versions/fullnarp_00000.json | 1 + versions/fullnarp_00000.json | 1 - 3 files changed, 5 insertions(+), 5 deletions(-) create mode 100644 var/versions/fullnarp_00000.json delete mode 100644 versions/fullnarp_00000.json diff --git a/fullnarp.py b/fullnarp.py index 1085732..2007749 100644 --- a/fullnarp.py +++ b/fullnarp.py @@ -20,7 +20,7 @@ a halfnarp2 checked out in the home of user halfnarp: } location /fullnarp/versions { - alias /home/halfnarp/halfnarp2/versions/; + alias /home/halfnarp/halfnarp2/var/versions/; } location /fullnarp/ws/ { @@ -185,7 +185,7 @@ async def handle_client(websocket): "lastupdate": int(newest_version), } with open( - "versions/fullnarp_" + "var/versions/fullnarp_" + str(newest_version).zfill(5) + ".json", "w", @@ -227,14 +227,14 @@ async def main(): Base.metadata.create_all(bind=engine) # load state file - newest_file = sorted(listdir("versions/"))[-1] + newest_file = sorted(listdir("var/versions/"))[-1] global newest_version global current_version if newest_file: newest_version = int(newest_file.replace("fullnarp_", "").replace(".json", "")) print("Resuming from version: " + str(newest_version)) - with open("versions/" + str(newest_file)) as data_file: + with open("var/versions/" + str(newest_file)) as data_file: current_version = json.load(data_file) else: current_version = {} diff --git a/var/versions/fullnarp_00000.json b/var/versions/fullnarp_00000.json new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/var/versions/fullnarp_00000.json @@ -0,0 +1 @@ +{} diff --git a/versions/fullnarp_00000.json b/versions/fullnarp_00000.json deleted file mode 100644 index 0967ef4..0000000 --- a/versions/fullnarp_00000.json +++ /dev/null @@ -1 +0,0 @@ -{} -- cgit v1.2.3