Use http to talk to auth on prod, to save a round trip.
This commit is contained in:
parent
c7de2b8fc2
commit
772c9b405b
1 changed files with 2 additions and 1 deletions
|
@ -11,6 +11,7 @@ app = Flask(__name__)
|
||||||
|
|
||||||
domain_root = os.environ['DOMAIN_ROOT']
|
domain_root = os.environ['DOMAIN_ROOT']
|
||||||
ibm_root = os.environ['IBM_API_ROOT']
|
ibm_root = os.environ['IBM_API_ROOT']
|
||||||
|
http_protocol = os.environ.get('HTTP_PROTOCOL', 'https')
|
||||||
|
|
||||||
# For some reason, the standard float converter rejects negative numbers
|
# For some reason, the standard float converter rejects negative numbers
|
||||||
# (and also integers without a decimal point).
|
# (and also integers without a decimal point).
|
||||||
|
@ -39,7 +40,7 @@ def heartbeat():
|
||||||
def geocode(latitude, longitude):
|
def geocode(latitude, longitude):
|
||||||
if not request.args.get('access_token'):
|
if not request.args.get('access_token'):
|
||||||
abort(401)
|
abort(401)
|
||||||
user_req = requests.get(f"http://auth.{domain_root}/api/v1/me",
|
user_req = requests.get(f"{http_protocol}://auth.{domain_root}/api/v1/me",
|
||||||
headers={'Authorization': f"Bearer {request.args['access_token']}"})
|
headers={'Authorization': f"Bearer {request.args['access_token']}"})
|
||||||
user_req.raise_for_status()
|
user_req.raise_for_status()
|
||||||
if not user_req.json()['is_subscribed']:
|
if not user_req.json()['is_subscribed']:
|
||||||
|
|
Reference in a new issue