🔒️ Inject Password + username

This commit is contained in:
Andreas Dinauer 2026-03-22 09:39:21 +01:00
parent 322bfcb702
commit bf59d4a014
2 changed files with 8 additions and 3 deletions

View File

@ -15,5 +15,5 @@ export default defineNuxtConfig({
{ rel: 'icon', type: 'image/x-icon', href: '/logo.ico' } { rel: 'icon', type: 'image/x-icon', href: '/logo.ico' }
] ]
} }
}, }
}) })

View File

@ -1,11 +1,16 @@
export default defineEventHandler(async (event) => { export default defineEventHandler(async (event) => {
if (process.env.NODE_ENV === 'development') if (process.env.NODE_ENV === 'development')
{ {
setHeader(event, "Authorization", "Basic " + Buffer.from("admin:pw").toString('base64')) 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, 'http://localhost:8089' + event.path, { return proxyRequest(event, 'http://localhost:8089' + event.path, {
fetchOptions: { fetchOptions: {
headers: { headers: {
Authorization: "Basic " + Buffer.from("admin:pw").toString('base64') Authorization: "Basic " + Buffer.from(user + ':' + password).toString('base64')
} }
} }
}); });