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 1212
1313import ghstack .logs
1414
15+ DEFAULT_GHSTACKRC_PATH = Path .home () / ".ghstackrc"
16+ GHSTACKRC_PATH_VAR = "GHSTACKRC_PATH"
17+
1518Config = NamedTuple (
1619 "Config" ,
1720 [
4144)
4245
4346
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+
4453def read_config (
4554 * ,
4655 request_circle_token : bool = False ,
@@ -60,7 +69,9 @@ def read_config(
6069
6170 write_back = False
6271 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+ )
6475 write_back = True
6576
6677 logging .debug (f"config_path = { config_path } " )
You can’t perform that action at this time.
0 commit comments