fix 4
This commit is contained in:
@@ -2,6 +2,7 @@ import express from 'express'
|
||||
import path from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import { config, assertServerConfig, WOMS_DATABASE_ID } from './config.js'
|
||||
import { verifyDatabaseAccess } from './services/appwriteAdmin.js'
|
||||
import { sessionMiddleware } from './middleware/session.js'
|
||||
import authRoutes from './routes/auth.js'
|
||||
import projectsRoutes from './routes/projects.js'
|
||||
@@ -22,12 +23,14 @@ app.use('/api/projects', projectsRoutes)
|
||||
app.use('/api/features', featuresRoutes)
|
||||
app.use('/webhook', giteaWebhookRoutes)
|
||||
|
||||
app.get('/api/health', (_req, res) => {
|
||||
app.get('/api/health', async (_req, res) => {
|
||||
const dbAccess = await verifyDatabaseAccess()
|
||||
res.json({
|
||||
ok: true,
|
||||
ok: dbAccess.ok,
|
||||
service: 'webklar-kundenbereich',
|
||||
databaseId: WOMS_DATABASE_ID,
|
||||
endpoint: config.appwrite.endpoint,
|
||||
appwriteDbAccess: dbAccess,
|
||||
})
|
||||
})
|
||||
|
||||
@@ -47,6 +50,13 @@ app.get('/', (_req, res) => {
|
||||
|
||||
const server = app.listen(config.port, () => {
|
||||
console.log(`Webklar Kundenbereich läuft auf Port ${config.port}`)
|
||||
verifyDatabaseAccess().then((result) => {
|
||||
if (result.ok) return
|
||||
console.error(
|
||||
'[startup] APPWRITE_API_KEY: Kein Lesezugriff auf woms-database. In Appwrite Console neuen API-Key mit Scopes databases.read + databases.write anlegen und in .env eintragen.'
|
||||
)
|
||||
if (result.reason) console.error(`[startup] Appwrite: ${result.reason}`)
|
||||
})
|
||||
})
|
||||
|
||||
server.on('error', (err) => {
|
||||
|
||||
Reference in New Issue
Block a user