From b8e7a6b392b46e7a54e5eb12a3f3d060936ef541 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Sat, 4 Apr 2015 20:12:50 +0200 Subject: [PATCH] made config settings optional without throwing an exception --- lgproxy.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lgproxy.py b/lgproxy.py index dc81509..e310b0d 100644 --- a/lgproxy.py +++ b/lgproxy.py @@ -52,13 +52,16 @@ def access_log_after(response, *args, **kwargs): def check_accesslist(): - if app.config["ACCESS_LIST"] and request.remote_addr not in app.config["ACCESS_LIST"]: - abort(401) + acl = app.config["ACCESS_LIST"] + if acl and request.remote_addr not in acl: + app.logger.warning("Remote address not in ACCESS_LIST: %s", request.remote_addr) + abort(401) def check_features(): features = app.config.get('FEATURES', []) - if request.endpoint not in features: + if features and request.endpoint not in features: + app.logger.warning("Requested endpoint not in FEATURES: %s", request.endpoint) abort(401)