make the locations of the pkey/cert configurable

This commit is contained in:
Damien Churchill 2009-07-16 09:24:55 +00:00
parent aa05a27d28
commit 45eb817301
1 changed files with 8 additions and 3 deletions

View File

@ -91,7 +91,9 @@ CONFIG_DEFAULTS = {
"show_keyword_search": False, "show_keyword_search": False,
"show_sidebar": True, "show_sidebar": True,
"cache_templates": False, "cache_templates": False,
"https": False "https": False,
"pkey": "ssl/daemon.pkey",
"cert": "ssl/daemon.cert"
} }
OLD_CONFIG_KEYS = ( OLD_CONFIG_KEYS = (
@ -384,8 +386,9 @@ class ServerContextFactory:
def getContext(self): def getContext(self):
"""Creates an SSL context.""" """Creates an SSL context."""
ctx = SSL.Context(SSL.SSLv3_METHOD) ctx = SSL.Context(SSL.SSLv3_METHOD)
ctx.use_privatekey_file(common.get_default_config_dir(os.path.join('ssl', 'daemon.pkey'))) deluge_web = component.get("DelugeWeb")
ctx.use_certificate_file(common.get_default_config_dir(os.path.join('ssl', 'daemon.cert'))) ctx.use_privatekey_file(common.get_default_config_dir(deluge_web.pkey))
ctx.use_certificate_file(common.get_default_config_dir(deluge_web.cert))
return ctx return ctx
class DelugeWeb(component.Component): class DelugeWeb(component.Component):
@ -420,6 +423,8 @@ class DelugeWeb(component.Component):
self.site = server.Site(self.top_level) self.site = server.Site(self.top_level)
self.port = self.config["port"] self.port = self.config["port"]
self.https = self.config["https"] self.https = self.config["https"]
self.pkey = self.config["pkey"]
self.cert = self.config["cert"]
self.web_api = WebApi() self.web_api = WebApi()
self.auth = Auth() self.auth = Auth()