Skip to content

Commit b399e20

Browse files
committed
Merge pull request disqus#17 from EClaesson/master
Loading of all arc config files (also on Windows)
2 parents e732651 + f2554a4 commit b399e20

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

phabricator/__init__.py

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,26 @@
3232
# Default phabricator interfaces
3333
INTERFACES = json.loads(open(os.path.join(os.path.dirname(__file__), 'interfaces.json'), 'r').read())
3434

35-
# Load ~/.arcrc if it exists
36-
try:
37-
ARCRC = json.loads(open(os.path.join(os.path.expanduser('~'), '.arcrc'), 'r').read())
38-
except IOError:
39-
ARCRC = None
35+
# Load arc config
36+
ARC_CONFIGS = [
37+
# System config
38+
os.path.join(os.environ['ProgramData'], 'Phabricator', 'Arcanist', 'config') if os.name == 'nt' else
39+
os.path.join('/etc', 'arcconfig'),
40+
41+
# User config
42+
os.path.join(os.environ['AppData'] if os.name == 'nt' else os.path.expanduser('~'), '.arcrc'),
43+
44+
# Project config
45+
os.path.join(os.getcwd(), '.arcconfig'),
46+
47+
# Local project config
48+
os.path.join(os.getcwd(), '.git', 'arc', 'config'),
49+
]
50+
51+
ARCRC = {}
52+
for conf in ARC_CONFIGS:
53+
if os.path.exists(conf):
54+
ARCRC.update(json.load(open(conf, 'r')))
4055

4156
# Map Phabricator types to Python types
4257
PARAM_TYPE_MAP = {

0 commit comments

Comments
 (0)