@@ -60,6 +60,7 @@ def _setup():
60
60
"name" : "stream" ,
61
61
"listen_host" : cfg .CONF .stream .host ,
62
62
"listen_port" : cfg .CONF .stream .port ,
63
+ "listen_ssl" : cfg .CONF .stream .use_ssl ,
63
64
"type" : "active" ,
64
65
}
65
66
common_setup (
@@ -78,15 +79,34 @@ def _setup():
78
79
def _run_server ():
79
80
host = cfg .CONF .stream .host
80
81
port = cfg .CONF .stream .port
82
+ use_ssl = cfg .CONF .stream .use_ssl
83
+
84
+ cert_file_path = os .path .realpath (cfg .CONF .stream .cert )
85
+ key_file_path = os .path .realpath (cfg .CONF .stream .key )
86
+
87
+ if use_ssl and not os .path .isfile (cert_file_path ):
88
+ raise ValueError ('Certificate file "%s" doesn\' t exist' % (cert_file_path ))
89
+
90
+ if use_ssl and not os .path .isfile (key_file_path ):
91
+ raise ValueError ('Private key file "%s" doesn\' t exist' % (key_file_path ))
81
92
82
93
LOG .info (
83
- "(PID=%s) ST2 Stream API is serving on http://%s:%s." , os .getpid (), host , port
94
+ "(PID=%s) ST2 Stream API is serving on %s://%s:%s." ,
95
+ os .getpid (),
96
+ "https" if use_ssl else "http" ,
97
+ host ,
98
+ port ,
84
99
)
85
100
86
101
max_pool_size = eventlet .wsgi .DEFAULT_MAX_SIMULTANEOUS_REQUESTS
87
102
worker_pool = eventlet .GreenPool (max_pool_size )
88
103
sock = eventlet .listen ((host , port ))
89
104
105
+ if use_ssl :
106
+ sock = eventlet .wrap_ssl (
107
+ sock , certfile = cert_file_path , keyfile = key_file_path , server_side = True
108
+ )
109
+
90
110
def queue_shutdown (signal_number , stack_frame ):
91
111
deregister_service (STREAM )
92
112
eventlet .spawn_n (
0 commit comments