File tree Expand file tree Collapse file tree 1 file changed +21
-5
lines changed
Expand file tree Collapse file tree 1 file changed +21
-5
lines changed Original file line number Diff line number Diff line change 88
99ERROR_MISSING_BINARY = "[MISSING_BINARY] missing dotenvx binary\n [MISSING_BINARY] https://github.com/dotenvx/dotenvx/issues/576"
1010
11- def load_dotenvx ():
12- output = get ()
11+ def load_dotenvx (
12+ dotenv_path = None ,
13+ override = False
14+ ):
15+ output = dotenvx_get (
16+ dotenv_path = dotenv_path ,
17+ override = override
18+ )
1319
1420 try :
1521 parsed = json .loads (output )
1622 for key , value in parsed .items ():
1723 os .environ [key ] = value
18- return parsed
24+ return True
1925 except Exception as e :
2026 raise RuntimeError (f"Failed to parse dotenvx output: { e } " )
2127
22- def get ():
28+ def dotenvx_get (
29+ dotenv_path = None ,
30+ override = False
31+ ):
2332 binpath = binary ()
33+ cmd = [binpath , "get" , "-pp" ]
34+
35+ if dotenv_path :
36+ cmd += ["-f" , dotenv_path ]
37+ if override :
38+ cmd .append ("--overload" )
39+
2440 output = subprocess .run (
25- [ binpath , "get" , "-pp" ] ,
41+ cmd ,
2642 capture_output = True ,
2743 text = True ,
2844 check = True
You can’t perform that action at this time.
0 commit comments