postgres: disables SSL in production web to see if that fixes issues

This commit is contained in:
@wwwjim 2020-07-22 11:34:24 -07:00
parent 346eb21b85
commit ea2d2d2eff
4 changed files with 30 additions and 4 deletions

View File

@ -12,4 +12,25 @@ module.exports = {
password: Environment.POSTGRES_ADMIN_PASSWORD,
},
},
www: {
client: "pg",
connection: {
port: 5432,
host: Environment.POSTGRES_HOSTNAME,
database: Environment.POSTGRES_DATABASE,
user: Environment.POSTGRES_ADMIN_USERNAME,
password: Environment.POSTGRES_ADMIN_PASSWORD,
},
},
production: {
client: "pg",
connection: {
ssl: true,
port: 5432,
host: Environment.POSTGRES_HOSTNAME,
database: Environment.POSTGRES_DATABASE,
user: Environment.POSTGRES_ADMIN_USERNAME,
password: Environment.POSTGRES_ADMIN_PASSWORD,
},
},
};

View File

@ -1,7 +1,9 @@
import * as Environment from "~/node_common/environment";
import configs from "~/knexfile";
import knex from "knex";
const envConfig = configs["development"];
const envConfig = configs[Environment.NODE];
const Database = knex(envConfig);
export default Database;

View File

@ -1,10 +1,12 @@
require("dotenv").config();
export const NODE = process.env.NODE_ENV;
export const NODE = process.env.NODE_ENV || "development";
export const IS_PRODUCTION = NODE === "production" || NODE === "www";
export const IS_PRODUCTION_WEB = NODE === "www";
export const PORT = process.env.PORT || 1337;
if (!IS_PRODUCTION_WEB) {
require("dotenv").config();
}
export const IS_LOCAL_WEB = !IS_PRODUCTION;
export const POSTGRES_ADMIN_PASSWORD = process.env.POSTGRES_ADMIN_PASSWORD;
export const POSTGRES_ADMIN_USERNAME = process.env.POSTGRES_ADMIN_USERNAME;

View File

@ -19,6 +19,7 @@ const handler = app.getRequestHandler();
app.prepare().then(async () => {
const server = express();
if (Environment.IS_PRODUCTION_WEB) {
server.use(compression());
}