def set_config_file(config_file=DEFAULT_CONFIG_FILE):
while True:
url = click.prompt('Please enter the SLR base URL (e.g. https://slo-metrics.example.com)')
with Action('Checking {}..'.format(url)):
requests.get(url, timeout=5, allow_redirects=False)
zmon_url = click.prompt('Please enter the ZMON URL (e.g. https://demo.zmon.io)')
with Action('Checking {}..'.format(zmon_url)):
requests.get(zmon_url, timeout=5, allow_redirects=False)
break
data = {
'url': url,
'zmon_url': zmon_url,
}
fn = os.path.expanduser(config_file)
with Action('Writing configuration to {}..'.format(fn)):
with open(fn, 'w') as fd:
json.dump(data, fd)
return data
评论列表
文章目录