DeepImagix commited on
Commit
ee7465a
·
verified ·
1 Parent(s): 089c99f

Create maintenance_control.py

Browse files
Files changed (1) hide show
  1. maintenance_control.py +14 -0
maintenance_control.py ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # maintenance_control.py
2
+ import os, json
3
+
4
+ MAINTENANCE_FILE = "/data/maintenance.json"
5
+
6
+ def is_maintenance_mode():
7
+ if os.path.exists(MAINTENANCE_FILE):
8
+ with open(MAINTENANCE_FILE) as f:
9
+ return json.load(f).get("active", False)
10
+ return False
11
+
12
+ def set_maintenance_mode(active: bool):
13
+ with open(MAINTENANCE_FILE, "w") as f:
14
+ json.dump({"active": active}, f)