Prepare Kalendartool for MPM and disable invites
This commit is contained in:
24
container-entrypoint.cjs
Normal file
24
container-entrypoint.cjs
Normal file
@@ -0,0 +1,24 @@
|
||||
'use strict';
|
||||
|
||||
const { spawnSync } = require('node:child_process');
|
||||
|
||||
const databaseUrl = new URL('postgresql://db:5432/calendar');
|
||||
databaseUrl.username = 'calendar_app';
|
||||
databaseUrl.password = process.env.CALENDAR_DB_PASSWORD || '';
|
||||
databaseUrl.searchParams.set('schema', 'public');
|
||||
process.env.DATABASE_URL = databaseUrl.toString();
|
||||
|
||||
function runNode(args) {
|
||||
const result = spawnSync(process.execPath, args, { stdio: 'inherit', env: process.env });
|
||||
if (result.error) throw result.error;
|
||||
if (result.status !== 0) process.exit(result.status ?? 1);
|
||||
}
|
||||
|
||||
runNode(['node_modules/prisma/build/index.js', 'migrate', 'deploy']);
|
||||
runNode(['prisma/seed-admin.cjs']);
|
||||
|
||||
if (process.env.MPM_AUTH_MODE === 'true') {
|
||||
require('./module-runtime.js');
|
||||
} else {
|
||||
runNode(['server.js']);
|
||||
}
|
||||
Reference in New Issue
Block a user