🔒️ Inject Password + username
This commit is contained in:
parent
322bfcb702
commit
bf59d4a014
@ -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' }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
})
|
})
|
||||||
@ -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')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user