diff --git a/.dockerignore b/.dockerignore index a21fd240..1434837b 100644 --- a/.dockerignore +++ b/.dockerignore @@ -7,7 +7,6 @@ !stubs !app !buildtools -!ormconfig.js !static !bower_components !sandbox diff --git a/app/server/companion.ts b/app/server/companion.ts index 787affed..df2ddd8c 100644 --- a/app/server/companion.ts +++ b/app/server/companion.ts @@ -2,12 +2,13 @@ import { version } from 'app/common/version'; import { synchronizeProducts } from 'app/gen-server/entity/Product'; import { HomeDBManager } from 'app/gen-server/lib/HomeDBManager'; import { applyPatch } from 'app/gen-server/lib/TypeORMPatches'; -import { getMigrations, getOrCreateConnection, undoLastMigration, updateDb } from 'app/server/lib/dbUtils'; +import { getMigrations, getOrCreateConnection, getTypeORMSettings, + undoLastMigration, updateDb } from 'app/server/lib/dbUtils'; import { getDatabaseUrl } from 'app/server/lib/serverUtils'; import { Gristifier } from 'app/server/utils/gristify'; import { pruneActionHistory } from 'app/server/utils/pruneActionHistory'; import * as commander from 'commander'; -import { Connection, getConnectionOptions } from 'typeorm'; +import { Connection } from 'typeorm'; /** * Main entrypoint for a cli toolbox for configuring aspects of Grist @@ -140,7 +141,7 @@ export function addDbCommand(program: commander.Command, sub('url') .description('construct a url for the database (for psql, catsql etc)') .action(withConnection(async () => { - console.log(getDatabaseUrl(await getConnectionOptions(), true)); + console.log(getDatabaseUrl(getTypeORMSettings(), true)); return 0; })); } @@ -175,7 +176,7 @@ export async function dbCheck(connection: Connection) { const changingProducts = await synchronizeProducts(connection, false); // eslint-disable-next-line @typescript-eslint/no-shadow const log = process.env.TYPEORM_LOGGING === 'true' ? console.log : (...args: any[]) => null; - const options = await getConnectionOptions(); + const options = getTypeORMSettings(); log("database url:", getDatabaseUrl(options, false)); log("migration files:", options.migrations); log("migrations applied to db:", migrations.migrationsInDb); diff --git a/app/server/lib/dbUtils.ts b/app/server/lib/dbUtils.ts index be299b3b..ec095dc3 100644 --- a/app/server/lib/dbUtils.ts +++ b/app/server/lib/dbUtils.ts @@ -103,7 +103,7 @@ export async function undoLastMigration(connection: Connection) { // Replace the old janky ormconfig.js file, which was always a source of // pain to use since it wasn't properly integrated into the typescript // project. -function getTypeORMSettings(): DataSourceOptions { +export function getTypeORMSettings(): DataSourceOptions { // If we have a redis server available, tell typeorm. Then any queries built with // .cache() called on them will be cached via redis. // We use a separate environment variable for the moment so that we don't have to