1
0

add SSL context to watchtower server

This commit is contained in:
ThomasV
2019-09-13 12:26:27 +02:00
parent 26efef9e06
commit 1ecbafb920
2 changed files with 15 additions and 13 deletions

View File

@@ -3,6 +3,7 @@ import threading
import time
import os
import stat
import ssl
from decimal import Decimal
from typing import Union, Optional
from numbers import Real
@@ -584,6 +585,14 @@ class SimpleConfig(Logger):
device = ''
return device
def get_ssl_context(self):
ssl_keyfile = self.get('ssl_keyfile')
ssl_certfile = self.get('ssl_certfile')
if ssl_keyfile and ssl_certfile:
ssl_context = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)
ssl_context.load_cert_chain(ssl_certfile, ssl_keyfile)
return ssl_context
def read_user_config(path):
"""Parse and store the user config settings in electrum.conf into user_config[]."""