From 75b1ef1ef4ea6a35d134e30e3c9723f9161fa140 Mon Sep 17 00:00:00 2001 From: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> Date: Wed, 26 Oct 2022 21:04:12 -0700 Subject: Make `"tls"` an explicit object we pass instead of implicit top-level options cc @Electroid @colinhacks --- src/bun.js/api/server.zig | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'src/bun.js/api/server.zig') diff --git a/src/bun.js/api/server.zig b/src/bun.js/api/server.zig index 73480a93d..c86edf534 100644 --- a/src/bun.js/api/server.zig +++ b/src/bun.js/api/server.zig @@ -329,12 +329,26 @@ pub const ServerConfig = struct { args.development = dev.toBoolean(); } - if (SSLConfig.fromJS(global, arguments, exception)) |ssl_config| { - args.ssl_config = ssl_config; + if (arg.getTruthy("tls")) |tls| { + if (SSLConfig.inJS(global, tls, exception)) |ssl_config| { + args.ssl_config = ssl_config; + } + + if (exception.* != null) { + return args; + } } - if (exception.* != null) { - return args; + // @compatibility Bun v0.x - v0.2.1 + // this used to be top-level, now it's "tls" object + if (args.ssl_config == null) { + if (SSLConfig.inJS(global, arg, exception)) |ssl_config| { + args.ssl_config = ssl_config; + } + + if (exception.* != null) { + return args; + } } if (arg.getTruthy(global, "maxRequestBodySize")) |max_request_body_size| { -- cgit v1.2.3