diff --git a/src/config/index.js b/src/config/index.js index 80c5ae7e..cef7003e 100644 --- a/src/config/index.js +++ b/src/config/index.js @@ -68,10 +68,7 @@ async function getConfig() { // CORS .prop("CORS_ORIGIN", S.anyOf([S.string(), S.null()])) .prop("CORS_ALLOWED_HEADERS", S.anyOf([S.string(), S.null()])) - .prop( - "CORS_ALLOW_CREDENTIALS", - S.anyOf([S.string().enum(["true"]), S.null()]) - ) + .prop("CORS_ALLOW_CREDENTIALS", S.anyOf([S.boolean(), S.null()])) .prop("CORS_EXPOSED_HEADERS", S.anyOf([S.string(), S.null()])) .prop("CORS_MAX_AGE", S.anyOf([S.number(), S.null()])) @@ -80,10 +77,7 @@ async function getConfig() { .prop("HTTPS_PFX_FILE_PATH", S.anyOf([S.string(), S.null()])) .prop("HTTPS_SSL_CERT_PATH", S.anyOf([S.string(), S.null()])) .prop("HTTPS_SSL_KEY_PATH", S.anyOf([S.string(), S.null()])) - .prop( - "HTTPS_HTTP2_ENABLED", - S.anyOf([S.string().enum(["true"]), S.null()]) - ) + .prop("HTTPS_HTTP2_ENABLED", S.anyOf([S.boolean(), S.null()])) // Logger .prop( @@ -323,7 +317,7 @@ async function getConfig() { }; } - if (String(env.CORS_ALLOW_CREDENTIALS) === "true") { + if (env.CORS_ALLOW_CREDENTIALS === true) { config.cors.credentials = true; } if (env.CORS_ALLOWED_HEADERS) { @@ -372,10 +366,7 @@ async function getConfig() { } } - if ( - config.fastifyInit.https && - String(env.HTTPS_HTTP2_ENABLED).toLowerCase().trim() === "true" - ) { + if (config.fastifyInit.https && env.HTTPS_HTTP2_ENABLED === true) { config.fastifyInit.https.allowHTTP1 = true; config.fastifyInit.http2 = true; }