diff --git a/server/routes/api/[...path].ts b/server/routes/api/[...path].ts index 7f012c5..3eb86e2 100644 --- a/server/routes/api/[...path].ts +++ b/server/routes/api/[...path].ts @@ -1,18 +1,16 @@ export default defineEventHandler(async (event) => { - if (process.env.NODE_ENV === 'development') + const user = process.env.NUXT_PRIVATE_SUPERUSER_USER; + const password = process.env.NUXT_PRIVATE_SUPERUSER_PASSWORD; + if (user == null || password == null) { - const user = process.env.NUXT_PRIVATE_SUPERUSER_USER; - const password = process.env.NUXT_PRIVATE_SUPERUSER_PASSWORD; - if (user == null || password == null) - { - throw new Error(); - } - return proxyRequest(event, process.env.NUXT_PUBLIC_BASE_URL + event.path, { - fetchOptions: { - headers: { - Authorization: "Basic " + Buffer.from(user + ':' + password).toString('base64') - } - } - }); + console.error("Username or password is null."); + throw Error(); } + return proxyRequest(event, process.env.NUXT_PUBLIC_BASE_URL + event.path, { + fetchOptions: { + headers: { + Authorization: "Basic " + Buffer.from(user + ':' + password).toString('base64') + } + } + }); }) \ No newline at end of file