Wauplin HF Staff commited on
Commit
9df7818
·
verified ·
1 Parent(s): 3ca3e6a

backup commands

Browse files
Files changed (1) hide show
  1. backend/src/constants.py +19 -0
backend/src/constants.py CHANGED
@@ -36,3 +36,22 @@ if SERVE_FRONTEND and (
36
  BACKUP_DATASET_ID = os.getenv("BACKUP_DATASET_ID")
37
  HF_TOKEN = os.getenv("HF_TOKEN")
38
  BACKUP_DB = BACKUP_DATASET_ID is not None and HF_TOKEN is not None
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  BACKUP_DATASET_ID = os.getenv("BACKUP_DATASET_ID")
37
  HF_TOKEN = os.getenv("HF_TOKEN")
38
  BACKUP_DB = BACKUP_DATASET_ID is not None and HF_TOKEN is not None
39
+
40
+ if BACKUP_DATASET_ID is not None:
41
+ if HF_TOKEN is None:
42
+ print(
43
+ f"Backup dataset ID {BACKUP_DATASET_ID} is set, but HF_TOKEN is not set."
44
+ "\nPlease set HF_TOKEN as environment variable to enable backup."
45
+ )
46
+ else:
47
+ print(f"Backup enabled to dataset: {BACKUP_DATASET_ID}")
48
+ else:
49
+ if HF_TOKEN is not None:
50
+ print(
51
+ "HF_TOKEN is set, but BACKUP_DATASET_ID is not set."
52
+ "\nPlease set BACKUP_DATASET_ID as environment variable to enable backup."
53
+ )
54
+ else:
55
+ print(
56
+ "Backup disabled. You must set BACKUP_DATASET_ID and HF_TOKEN as environment variables to enable backup."
57
+ )