@@ -23,6 +23,8 @@ def __init__(
23
23
protocol : str = "http" ,
24
24
host : str = "localhost" ,
25
25
port : int = 8080 ,
26
+ ssl_keyfile : Optional [str ] = None ,
27
+ ssl_certfile : Optional [str ] = None ,
26
28
endpoint : Optional [str ] = "/" ,
27
29
input_datatype : Type [Any ] = TextDoc ,
28
30
output_datatype : Type [Any ] = TextDoc ,
@@ -42,6 +44,13 @@ def __init__(
42
44
self .input_datatype = input_datatype
43
45
self .output_datatype = output_datatype
44
46
self .use_remote_service = use_remote_service
47
+ self .uvicorn_kwargs = {}
48
+
49
+ if ssl_keyfile :
50
+ self .uvicorn_kwargs ["ssl_keyfile" ] = ssl_keyfile
51
+
52
+ if ssl_certfile :
53
+ self .uvicorn_kwargs ["ssl_certfile" ] = ssl_certfile
45
54
46
55
if not use_remote_service :
47
56
self .replicas = replicas
@@ -81,7 +90,7 @@ def _get_server(self):
81
90
"description" : "OPEA Microservice Infrastructure" ,
82
91
}
83
92
84
- return HTTPService (runtime_args = runtime_args )
93
+ return HTTPService (uvicorn_kwargs = self . uvicorn_kwargs , runtime_args = runtime_args )
85
94
86
95
async def _async_setup (self ):
87
96
"""The async method setup the runtime.
@@ -140,6 +149,8 @@ def register_microservice(
140
149
protocol : str = "http" ,
141
150
host : str = "localhost" ,
142
151
port : int = 8080 ,
152
+ ssl_keyfile : Optional [str ] = None ,
153
+ ssl_certfile : Optional [str ] = None ,
143
154
endpoint : Optional [str ] = "/" ,
144
155
input_datatype : Type [Any ] = TextDoc ,
145
156
output_datatype : Type [Any ] = TextDoc ,
@@ -155,6 +166,8 @@ def decorator(func):
155
166
protocol = protocol ,
156
167
host = host ,
157
168
port = port ,
169
+ ssl_keyfile = ssl_keyfile ,
170
+ ssl_certfile = ssl_certfile ,
158
171
endpoint = endpoint ,
159
172
input_datatype = input_datatype ,
160
173
output_datatype = output_datatype ,
0 commit comments