From 6b81b888a1d8d428d76a91d347cca385548fba29 Mon Sep 17 00:00:00 2001 From: 66Leo66 <33322229+66Leo66@users.noreply.github.com> Date: Thu, 5 May 2022 21:22:29 +0800 Subject: [PATCH] Allow overriding config with ENV (#506) Allow overriding config with ENV (handy when running with docker or debugging without modifying script) Also log proxy config for easier debugging (when sharing screenshots) --- proxy_config.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/proxy_config.py b/proxy_config.py index 5025a974..07bac1a3 100644 --- a/proxy_config.py +++ b/proxy_config.py @@ -1,4 +1,17 @@ +import os + # This can also be replaced with another IP address. USE_SSL = True -REMOTE_HOST = "127.0.0.1" -REMOTE_PORT = 443 \ No newline at end of file +REMOTE_HOST = "localhost" +REMOTE_PORT = 443 + +if os.getenv('MITM_REMOTE_HOST') != None: + REMOTE_HOST = os.getenv('MITM_REMOTE_HOST') +if os.getenv('MITM_REMOTE_PORT') != None: + REMOTE_PORT = int(os.getenv('MITM_REMOTE_PORT')) +if os.getenv('MITM_USE_SSL') != None: + USE_SSL = bool(os.getenv('MITM_USE_SSL')) + +print('MITM Remote Host: ' + REMOTE_HOST) +print('MITM Remote Port: ' + str(REMOTE_PORT)) +print('MITM Use SSL ' + str(USE_SSL))