Skip to content

Commit

Permalink
Fix FileType issue
Browse files Browse the repository at this point in the history
- args.FileType returns a FileType object. `load_cert_chain` expects public/private key paths as `str`. `name` attribute (of `FileType`) returns exactly what is needed.
  • Loading branch information
argysamo committed Oct 22, 2023
1 parent ff05593 commit 80c57ad
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions prometheus_aioexporter/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,13 @@ def _get_ssl_context(self, args: argparse.Namespace) -> SSLContext | None:
return None
cafile = None
if args.ssl_ca:
cafile = args.ssl_ca
cafile = args.ssl_ca.name
ssl_context = ssl.create_default_context(
purpose=ssl.Purpose.CLIENT_AUTH, cafile=cafile
)
ssl_context.load_cert_chain(args.ssl_public_key, args.ssl_private_key)
ssl_context.load_cert_chain(
args.ssl_public_key.name, args.ssl_private_key.name
)

return ssl_context

Expand Down

0 comments on commit 80c57ad

Please sign in to comment.