Skip to content

Commit a453068

Browse files
committed
proper path to .env file
1 parent d86a756 commit a453068

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

scripts/migration/migrate.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,19 @@
2424
OUTPUT_FILE = f"migrated_new_users_{timestamp}.log"
2525

2626
# Load environment variables
27-
path_to_env = os.path.join(os.getcwd(), ".env")
27+
path_to_env = os.path.join(os.getcwd(),"scripts","migration", ".env")
2828
config = dotenv_values(dotenv_path=path_to_env)
2929

3030
CLOWDER_V1 = config["CLOWDER_V1"]
3131
ADMIN_KEY_V1 = config["ADMIN_KEY_V1"]
3232
CLOWDER_V2 = config["CLOWDER_V2"]
3333
ADMIN_KEY_V2 = config["ADMIN_KEY_V2"]
3434

35+
if not CLOWDER_V1 or not ADMIN_KEY_V1 or not CLOWDER_V2 or not ADMIN_KEY_V2:
36+
print("MISSING SOME ENVIRONMENT VARIABLES")
37+
else:
38+
print("WE HAVE THEM ALL")
39+
3540
base_headers_v1 = {"X-API-key": ADMIN_KEY_V1}
3641
base_headers_v2 = {"X-API-key": ADMIN_KEY_V2}
3742

scripts/migration/migrate_metadata_definitions.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@
44
import requests
55
from dotenv import dotenv_values
66

7-
path_to_env = os.path.join(os.getcwd(), ".env")
7+
path_to_env = os.path.join(os.getcwd(),"scripts","migration", ".env")
8+
if not os.path.exists(path_to_env):
9+
raise FileNotFoundError(
10+
f"Environment file not found at {path_to_env}. Please ensure it exists."
11+
)
812
config = dotenv_values(dotenv_path=path_to_env)
913

1014
CLOWDER_V1_URL = config["CLOWDER_V1"]
@@ -13,6 +17,11 @@
1317
CLOWDER_V2_URL = config["CLOWDER_V2"]
1418
ADMIN_KEY_V2 = config["ADMIN_KEY_V2"]
1519

20+
if not CLOWDER_V1_URL or not ADMIN_KEY_V1 or not CLOWDER_V2_URL or not ADMIN_KEY_V2:
21+
print("MISSING SOME ENVIRONMENT VARIABLES")
22+
else:
23+
print("WE HAVE THEM ALL")
24+
1625
base_headers_v1 = {"X-API-key": ADMIN_KEY_V1}
1726
clowder_headers_v1 = {
1827
**base_headers_v1,

0 commit comments

Comments
 (0)