hasurafix

This commit is contained in:
2026-05-22 11:08:17 +05:30
parent 95cc80b4a8
commit 25dcc9ad59
5 changed files with 41 additions and 2 deletions

View File

@@ -5,7 +5,7 @@ import react from '@vitejs/plugin-react'
// server-side so the secret never reaches the browser.
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), '')
const secret = (env.HASURA_ADMIN_SECRET || '').trim()
const secret = (env.HASURA_ADMIN_SECRET || 'nearle-admin-secret').trim()
if (!secret) {
console.warn('[xpress-docs] HASURA_ADMIN_SECRET is not set in .env.local; proxied requests will hit the API without auth.')
@@ -22,6 +22,16 @@ export default defineConfig(({ mode }) => {
})
}
},
'/v1': {
target: 'https://api.workolik.com',
changeOrigin: true,
secure: true,
configure: (proxy) => {
proxy.on('proxyReq', (proxyReq) => {
if (secret) proxyReq.setHeader('x-hasura-admin-secret', secret)
})
}
},
'/live': {
target: 'https://jupiter.nearle.app',
changeOrigin: true,