diff --git a/apps/sdlan/src/quic/sdlan_quic_server.erl b/apps/sdlan/src/quic/sdlan_quic_server.erl index 3c666e0..c08cf6c 100644 --- a/apps/sdlan/src/quic/sdlan_quic_server.erl +++ b/apps/sdlan/src/quic/sdlan_quic_server.erl @@ -20,13 +20,17 @@ init() -> Port = proplists:get_value(port, Props), Alpn = proplists:get_value(alpn, Props), Limits = proplists:get_value(limits, Props), + CertFile = proplists:get_value(certfile, Props), + KeyFile = proplists:get_value(keyfile, Props), + + %% 获取环境变量 + Path = os:getenv("QUIC_CERT_PATH", code:priv_dir(sdlan)), - Path = code:priv_dir(sdlan), LOptions = #{ addr_family => inet, % 必选:QUIC/TLS证书配置 - certfile => Path ++ "/cert.pem", - keyfile => Path ++ "/key.pem", + certfile => Path ++ "/" ++ CertFile, + keyfile => Path ++ "/" ++ KeyFile, alpn => Alpn, peer_bidi_stream_count => 1, conn_acceptors => 10 diff --git a/config/sys-dev.config b/config/sys-dev.config index 173a294..02f0c2e 100644 --- a/config/sys-dev.config +++ b/config/sys-dev.config @@ -11,6 +11,8 @@ {quic_server, [ {port, 443}, {alpn, ["punchnet/1.0"]}, + {certfile, "cert.pem"}, + {keyfile, "key.pem"}, {limits, [ {max_packet_size, 16384}, %% 单位为秒 diff --git a/config/sys-prod.config b/config/sys-prod.config index 98f16fb..38cbd51 100644 --- a/config/sys-prod.config +++ b/config/sys-prod.config @@ -11,6 +11,8 @@ {quic_server, [ {port, 443}, {alpn, ["punchnet/1.0"]}, + {certfile, "fullchain.cer"}, + {keyfile, "punchsky.com.key"}, {limits, [ {max_packet_size, 16384}, %% 单位为秒