Skip to content

Commit

Permalink
only add the parameters for the certificate parameters if https inter…
Browse files Browse the repository at this point in the history
…ception is enabled
  • Loading branch information
Jenifer Tabita Ciuciu-Kiss committed Sep 9, 2024
1 parent 1bc4e89 commit 56c4d7a
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 37 deletions.
19 changes: 10 additions & 9 deletions ontologytimemachine/custom_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
IP = '0.0.0.0'
PORT = '8899'

config = None
config = ({'format': 'turtle', 'precedence': 'enforcedPriority', 'patchAcceptUpstream': False}, 'originalFailoverLiveLatest', False, 'all', False, True, None, None)

logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
logger = logging.getLogger(__name__)
Expand All @@ -27,7 +27,7 @@ def __init__(self, *args, **kwargs):
(self.ontoFormat, self.ontoVersion, self.restrictedAccess,
self.httpsInterception, self.disableRemovingRedirects,
self.forward_headers, self.timestamp, self.manifest) = config
logger.info(config)
logger.info()

def before_upstream_connection(self, request: HttpParser):
logger.info('Before upstream connection hook')
Expand Down Expand Up @@ -98,18 +98,19 @@ def queue_response(self, response):

sys.argv = [sys.argv[0]] # TODO: fix this

sys.argv += [
'--ca-key-file', 'ca-key.pem',
'--ca-cert-file', 'ca-cert.pem',
'--ca-signing-key-file', 'ca-signing-key.pem',
]
# check it https interception is enabled
if config[3] != 'none':
sys.argv += [
'--ca-key-file', 'ca-key.pem',
'--ca-cert-file', 'ca-cert.pem',
'--ca-signing-key-file', 'ca-signing-key.pem',
]

sys.argv += [
'--hostname', IP,
'--port', PORT,
'--plugins', __name__ + '.OntologyTimeMachinePlugin'
]

print(sys.argv)

logger.info("Starting OntologyTimeMachineProxy server...")
proxy.main()
62 changes: 34 additions & 28 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 56c4d7a

Please sign in to comment.