schema + docker cleanups

This commit is contained in:
Philipp Dormann 2021-05-22 17:37:00 +02:00
parent ae7de014a6
commit 4a21d9e9d9
9 changed files with 119 additions and 293 deletions

View file

@ -1,30 +0,0 @@
require('dotenv').config();
const fs = require('fs');
const path = require('path');
function getDatabase() {
const type =
process.env.DATABASE_TYPE ||
(process.env.DATABASE_URL && process.env.DATABASE_URL.split(':')[0]);
if (type === 'postgres') {
return 'postgresql';
}
return type;
}
const databaseType = getDatabase();
if (!databaseType || !['mysql', 'postgresql'].includes(databaseType)) {
throw new Error('Missing or invalid database');
}
console.log(`Database type detected: ${databaseType}`);
const src = path.resolve(__dirname, `../prisma/schema.${databaseType}.prisma`);
const dest = path.resolve(__dirname, '../prisma/schema.prisma');
fs.copyFileSync(src, dest);
console.log(`Copied ${src} to ${dest}`);

View file

@ -1,3 +1,3 @@
const cli = require('next/dist/cli/next-start');
cli.nextStart(['-p', process.env.PORT || 3000, '-H', process.env.HOSTNAME || '0.0.0.0']);
cli.nextStart(['-p', process.env.PORT || 50001, '-H', process.env.HOSTNAME || '0.0.0.0']);