File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change 12
12
13
13
import ghstack .logs
14
14
15
+ DEFAULT_GHSTACKRC_PATH = Path .home () / ".ghstackrc"
16
+ GHSTACKRC_PATH_VAR = "GHSTACKRC_PATH"
17
+
15
18
Config = NamedTuple (
16
19
"Config" ,
17
20
[
41
44
)
42
45
43
46
47
+ def get_path_from_env_var (var_name : str ) -> Optional [Path ]:
48
+ if (path := os .environ .get (var_name )) is not None :
49
+ return Path (path ).expanduser ().resolve ()
50
+ return None
51
+
52
+
44
53
def read_config (
45
54
* ,
46
55
request_circle_token : bool = False ,
@@ -60,7 +69,9 @@ def read_config(
60
69
61
70
write_back = False
62
71
if config_path is None :
63
- config_path = os .path .expanduser ("~/.ghstackrc" )
72
+ config_path = str (
73
+ get_path_from_env_var (GHSTACKRC_PATH_VAR ) or DEFAULT_GHSTACKRC_PATH
74
+ )
64
75
write_back = True
65
76
66
77
logging .debug (f"config_path = { config_path } " )
You can’t perform that action at this time.
0 commit comments