Skip to content

Commit

Permalink
fix: handling HTTP-only args
Browse files Browse the repository at this point in the history
Signed-off-by: Aaron Pham <[email protected]>
  • Loading branch information
aarnphm committed Jan 10, 2023
1 parent 219e2cd commit 723336d
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/bentoml/bentos.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,12 +454,23 @@ def serve(
if server_type not in ["http", "grpc"]:
raise ValueError('Server type must either be "http" or "grpc"')

ssl_args = {
"ssl_certfile": ssl_certfile,
"ssl_keyfile": ssl_keyfile,
"ssl_ca_certs": ssl_ca_certs,
}
if server_type == "http":
serve_cmd = "serve-http"
if host is None:
host = BentoMLContainer.http.host.get()
if port is None:
port = BentoMLContainer.http.port.get()
ssl_args.update(
ssl_keyfile_password=ssl_keyfile_password,
ssl_version=ssl_version,
ssl_cert_reqs=ssl_cert_reqs,
ssl_ciphers=ssl_ciphers,
)
else:
serve_cmd = "serve-grpc"
if host is None:
Expand All @@ -480,15 +491,7 @@ def serve(
str(port),
"--backlog",
str(backlog),
*construct_ssl_args(
ssl_certfile=ssl_certfile,
ssl_keyfile=ssl_keyfile,
ssl_keyfile_password=ssl_keyfile_password,
ssl_version=ssl_version,
ssl_cert_reqs=ssl_cert_reqs,
ssl_ca_certs=ssl_ca_certs,
ssl_ciphers=ssl_ciphers,
),
*construct_ssl_args(**ssl_args),
]
if production:
args.append("--production")
Expand Down

0 comments on commit 723336d

Please sign in to comment.