Monorepo for wisp.place. A static site hosting service built on top of the AT Protocol. wisp.place

ensure NODE_ENV = production is respected

Changed files
+12 -7
src
+12 -7
src/index.ts
··· 1 1 import { Elysia } from 'elysia' 2 + import type { Context } from 'elysia' 2 3 import { cors } from '@elysiajs/cors' 3 - import { openapi, fromTypes } from '@elysiajs/openapi' 4 4 import { staticPlugin } from '@elysiajs/static' 5 5 6 6 import type { Config } from './lib/types' ··· 22 22 import { logger, logCollector, observabilityMiddleware } from './lib/observability' 23 23 import { promptAdminSetup } from './lib/admin-auth' 24 24 import { adminRoutes } from './routes/admin' 25 + import { previewRoutes } from './routes/preview' 25 26 26 27 const config: Config = { 27 28 domain: (Bun.env.DOMAIN ?? `https://${BASE_HOST}`) as Config['domain'], ··· 59 60 logger.info('DNS Verifier Started - checking custom domains every 10 minutes') 60 61 61 62 export const app = new Elysia() 62 - .use(openapi({ 63 - references: fromTypes() 64 - })) 63 + .server({ 64 + development: Bun.env.NODE_ENV !== 'production', 65 + }) 66 + .serve({ 67 + hmr: Bun.env.NODE_ENV !== 'production' 68 + }) 65 69 // Observability middleware 66 70 .onBeforeHandle(observabilityMiddleware('main-app').beforeHandle) 67 - .onAfterHandle((ctx) => { 71 + .onAfterHandle((ctx: Context) => { 68 72 observabilityMiddleware('main-app').afterHandle(ctx) 69 73 // Security headers middleware 70 74 const { set } = ctx ··· 99 103 .use(userRoutes(client)) 100 104 .use(siteRoutes(client)) 101 105 .use(adminRoutes()) 106 + .use(previewRoutes) 102 107 .use( 103 108 await staticPlugin({ 104 109 prefix: '/' 105 110 }) 106 111 ) 107 - .get('/client-metadata.json', (c) => { 112 + .get('/client-metadata.json', () => { 108 113 return createClientMetadata(config) 109 114 }) 110 - .get('/jwks.json', async (c) => { 115 + .get('/jwks.json', async () => { 111 116 const keys = await getCurrentKeys() 112 117 if (!keys.length) return { keys: [] } 113 118