(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
!app
!buildtools
!ormconfig.js
!static
!bower_components
!sandbox

@ -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);

@ -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

Loading…
Cancel
Save