Skip to content
This repository was archived by the owner on Apr 15, 2024. It is now read-only.
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
16 changes: 11 additions & 5 deletions consul/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,13 +313,19 @@ def __init__(
if os.getenv('CONSUL_HTTP_ADDR'):
try:
host, port = os.getenv('CONSUL_HTTP_ADDR').split(':')
scheme = 'http'
except ValueError:
raise ConsulException('CONSUL_HTTP_ADDR (%s) invalid, '
'does not match <host>:<port>'
% os.getenv('CONSUL_HTTP_ADDR'))
try:
scheme, host, port = os.getenv('CONSUL_HTTP_ADDR').split(':')
host = host.lstrip('//')
except ValueError:
raise ConsulException('CONSUL_HTTP_ADDR (%s) invalid, '
'does not match <host>:<port> or '
'<protocol>:<host>:<port>'
% os.getenv('CONSUL_HTTP_ADDR'))
use_ssl = os.getenv('CONSUL_HTTP_SSL')
if use_ssl is not None:
scheme = 'https' if use_ssl == 'true' else 'http'
if use_ssl == 'true':
scheme = 'https'
if os.getenv('CONSUL_HTTP_SSL_VERIFY') is not None:
verify = os.getenv('CONSUL_HTTP_SSL_VERIFY') == 'true'

Expand Down