(core) remove ormconfig.js from saas build; more sendgrid logging

Summary:
This removes ormconfig.js from the saas build since it is no longer
needed (and has always been a pain point).

This expands some sendgrid logging to help figure out a problem.

Test Plan: existing tests should pass

Reviewers: georgegevoian

Reviewed By: georgegevoian

Differential Revision: https://phab.getgrist.com/D3808
pull/452/head
Paul Fitzpatrick 1 year ago
parent aa3faae25b
commit e9efac05f7

@ -7,7 +7,6 @@
!stubs !stubs
!app !app
!buildtools !buildtools
!ormconfig.js
!static !static
!bower_components !bower_components
!sandbox !sandbox

@ -2,12 +2,13 @@ import { version } from 'app/common/version';
import { synchronizeProducts } from 'app/gen-server/entity/Product'; import { synchronizeProducts } from 'app/gen-server/entity/Product';
import { HomeDBManager } from 'app/gen-server/lib/HomeDBManager'; import { HomeDBManager } from 'app/gen-server/lib/HomeDBManager';
import { applyPatch } from 'app/gen-server/lib/TypeORMPatches'; 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 { getDatabaseUrl } from 'app/server/lib/serverUtils';
import { Gristifier } from 'app/server/utils/gristify'; import { Gristifier } from 'app/server/utils/gristify';
import { pruneActionHistory } from 'app/server/utils/pruneActionHistory'; import { pruneActionHistory } from 'app/server/utils/pruneActionHistory';
import * as commander from 'commander'; 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 * Main entrypoint for a cli toolbox for configuring aspects of Grist
@ -140,7 +141,7 @@ export function addDbCommand(program: commander.Command,
sub('url') sub('url')
.description('construct a url for the database (for psql, catsql etc)') .description('construct a url for the database (for psql, catsql etc)')
.action(withConnection(async () => { .action(withConnection(async () => {
console.log(getDatabaseUrl(await getConnectionOptions(), true)); console.log(getDatabaseUrl(getTypeORMSettings(), true));
return 0; return 0;
})); }));
} }
@ -175,7 +176,7 @@ export async function dbCheck(connection: Connection) {
const changingProducts = await synchronizeProducts(connection, false); const changingProducts = await synchronizeProducts(connection, false);
// eslint-disable-next-line @typescript-eslint/no-shadow // eslint-disable-next-line @typescript-eslint/no-shadow
const log = process.env.TYPEORM_LOGGING === 'true' ? console.log : (...args: any[]) => null; 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("database url:", getDatabaseUrl(options, false));
log("migration files:", options.migrations); log("migration files:", options.migrations);
log("migrations applied to db:", migrations.migrationsInDb); log("migrations applied to db:", migrations.migrationsInDb);

@ -103,7 +103,7 @@ export async function undoLastMigration(connection: Connection) {
// Replace the old janky ormconfig.js file, which was always a source of // 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 // pain to use since it wasn't properly integrated into the typescript
// project. // project.
function getTypeORMSettings(): DataSourceOptions { export function getTypeORMSettings(): DataSourceOptions {
// If we have a redis server available, tell typeorm. Then any queries built with // If we have a redis server available, tell typeorm. Then any queries built with
// .cache() called on them will be cached via redis. // .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 // We use a separate environment variable for the moment so that we don't have to

Loading…
Cancel
Save