add ciphers in command and pass to hypercorn for proxy (#11916)
Signed-off-by: frankzye1 <frankzye@qq.com>
This commit is contained in:
parent
c36d0f667b
commit
0d486120bc
@ -147,6 +147,7 @@ class ProxyInitializationHelpers:
|
||||
port: int,
|
||||
ssl_certfile_path: str,
|
||||
ssl_keyfile_path: str,
|
||||
ciphers: Optional[str] = None,
|
||||
):
|
||||
"""
|
||||
Initialize litellm with `hypercorn`
|
||||
@ -168,6 +169,8 @@ class ProxyInitializationHelpers:
|
||||
)
|
||||
config.certfile = ssl_certfile_path
|
||||
config.keyfile = ssl_keyfile_path
|
||||
if ciphers is not None:
|
||||
config.ciphers = ciphers
|
||||
|
||||
# hypercorn serve raises a type warning when passing a fast api app - even though fast API is a valid type
|
||||
asyncio.run(serve(app, config)) # type: ignore
|
||||
@ -455,6 +458,12 @@ class ProxyInitializationHelpers:
|
||||
help="Path to the SSL certfile. Use this when you want to provide SSL certificate when starting proxy",
|
||||
envvar="SSL_CERTFILE_PATH",
|
||||
)
|
||||
@click.option(
|
||||
"--ciphers",
|
||||
default=None,
|
||||
type=str,
|
||||
help="Ciphers to use for the SSL setup.",
|
||||
)
|
||||
@click.option(
|
||||
"--use_prisma_migrate",
|
||||
is_flag=True,
|
||||
@ -508,6 +517,7 @@ def run_server( # noqa: PLR0915
|
||||
run_hypercorn,
|
||||
ssl_keyfile_path,
|
||||
ssl_certfile_path,
|
||||
ciphers,
|
||||
log_config,
|
||||
use_prisma_migrate,
|
||||
skip_server_startup,
|
||||
@ -819,6 +829,7 @@ def run_server( # noqa: PLR0915
|
||||
port=port,
|
||||
ssl_certfile_path=ssl_certfile_path,
|
||||
ssl_keyfile_path=ssl_keyfile_path,
|
||||
ciphers=ciphers,
|
||||
)
|
||||
|
||||
|
||||
|
||||
@ -121,7 +121,7 @@ class TestProxyInitializationHelpers:
|
||||
|
||||
# Execute
|
||||
ProxyInitializationHelpers._init_hypercorn_server(
|
||||
mock_app, "localhost", 8000, None, None
|
||||
mock_app, "localhost", 8000, None, None, None
|
||||
)
|
||||
|
||||
# Assert
|
||||
@ -129,7 +129,7 @@ class TestProxyInitializationHelpers:
|
||||
|
||||
# Test with SSL
|
||||
ProxyInitializationHelpers._init_hypercorn_server(
|
||||
mock_app, "localhost", 8000, "cert.pem", "key.pem"
|
||||
mock_app, "localhost", 8000, "cert.pem", "key.pem", "ECDHE"
|
||||
)
|
||||
|
||||
@patch("subprocess.Popen")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user