diff options
author | erdgeist <erdgeist@erdgeist.org> | 2025-01-06 04:03:17 +0100 |
---|---|---|
committer | erdgeist <erdgeist@erdgeist.org> | 2025-01-06 04:03:17 +0100 |
commit | c1d8ad88a43a87ac7ecdf7f324750252a9e6505b (patch) | |
tree | 33917e1fb29f8f9d4a9e3ac360882daf7ca5e76a | |
parent | 89f1f4006662f47186b32a38a5d85de5935512e5 (diff) |
Let versions reside under var/
-rw-r--r-- | fullnarp.py | 8 | ||||
-rw-r--r-- | var/versions/fullnarp_00000.json (renamed from versions/fullnarp_00000.json) | 0 |
2 files changed, 4 insertions, 4 deletions
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: | |||
20 | } | 20 | } |
21 | 21 | ||
22 | location /fullnarp/versions { | 22 | location /fullnarp/versions { |
23 | alias /home/halfnarp/halfnarp2/versions/; | 23 | alias /home/halfnarp/halfnarp2/var/versions/; |
24 | } | 24 | } |
25 | 25 | ||
26 | location /fullnarp/ws/ { | 26 | location /fullnarp/ws/ { |
@@ -185,7 +185,7 @@ async def handle_client(websocket): | |||
185 | "lastupdate": int(newest_version), | 185 | "lastupdate": int(newest_version), |
186 | } | 186 | } |
187 | with open( | 187 | with open( |
188 | "versions/fullnarp_" | 188 | "var/versions/fullnarp_" |
189 | + str(newest_version).zfill(5) | 189 | + str(newest_version).zfill(5) |
190 | + ".json", | 190 | + ".json", |
191 | "w", | 191 | "w", |
@@ -227,14 +227,14 @@ async def main(): | |||
227 | Base.metadata.create_all(bind=engine) | 227 | Base.metadata.create_all(bind=engine) |
228 | 228 | ||
229 | # load state file | 229 | # load state file |
230 | newest_file = sorted(listdir("versions/"))[-1] | 230 | newest_file = sorted(listdir("var/versions/"))[-1] |
231 | global newest_version | 231 | global newest_version |
232 | global current_version | 232 | global current_version |
233 | 233 | ||
234 | if newest_file: | 234 | if newest_file: |
235 | newest_version = int(newest_file.replace("fullnarp_", "").replace(".json", "")) | 235 | newest_version = int(newest_file.replace("fullnarp_", "").replace(".json", "")) |
236 | print("Resuming from version: " + str(newest_version)) | 236 | print("Resuming from version: " + str(newest_version)) |
237 | with open("versions/" + str(newest_file)) as data_file: | 237 | with open("var/versions/" + str(newest_file)) as data_file: |
238 | current_version = json.load(data_file) | 238 | current_version = json.load(data_file) |
239 | else: | 239 | else: |
240 | current_version = {} | 240 | current_version = {} |
diff --git a/versions/fullnarp_00000.json b/var/versions/fullnarp_00000.json index 0967ef4..0967ef4 100644 --- a/versions/fullnarp_00000.json +++ b/var/versions/fullnarp_00000.json | |||