Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions phabricator/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@


# Load arc config
ARCRC = {}
ARC_CONFIGS = (
# System config
os.path.join(
Expand All @@ -67,13 +68,19 @@
os.path.join(CURRENT_DIR, '.git', 'arc', 'config'),
)

ARCRC = {}
for conf in ARC_CONFIGS:
if os.path.exists(conf):
with open(conf, 'r') as fobj:

def update_arcrc(config_path):
"""Read a config file as JSON and update ARCRC.
"""
if config_path and os.path.exists(config_path):
with open(config_path, 'r') as fobj:
ARCRC.update(json.load(fobj))


for config in ARC_CONFIGS:
update_arcrc(config)


# Map Phabricator types to Python types
PARAM_TYPE_MAP = {
# int types
Expand Down Expand Up @@ -332,9 +339,10 @@ class Phabricator(Resource):
'json': lambda x: json.loads(x),
}

def __init__(self, username=None, certificate=None, host=None,
timeout=5, response_format='json', token=None, **kwargs):
def __init__(self, username=None, certificate=None, host=None, timeout=5,
response_format='json', token=None, config_path=None, **kwargs):

update_arcrc(config_path)
defined_hosts = ARCRC.get('hosts', {})

try:
Expand Down