Skip to content

Commit

Permalink
Merge stage (#25)
Browse files Browse the repository at this point in the history
Includes my PostgreSQL changes for local development and Kelvin's
changing-of-the-guard updates.
  • Loading branch information
JuliusSkylerSladeUSDS authored Jan 21, 2025
2 parents bd6ee9d + b9a2377 commit 939b614
Showing 8 changed files with 18 additions and 20 deletions.
4 changes: 4 additions & 0 deletions api/src/config/index.ts
Original file line number Diff line number Diff line change
@@ -60,6 +60,9 @@ const dbURI: string =
(process.env.VCAP_SERVICES && JSON.parse(process.env.VCAP_SERVICES)["aws-rds"][0].credentials.uri) ||
'postgres://docker_pg_user:docker_pg_pw@docker_db:5432/docker_db';

// Disable SSL connections to PostgreSQL for local development.
const dbDisableSSL:boolean = process.env.POSTGRES_DISABLE_SSL === 'true'

const openIdConfig: OpenIDConfiguration = {
issuerDiscover: process.env.ISSUER_DISCOVER || 'https://idp.int.identitysandbox.gov/.well-known/openid-configuration',
clientId: process.env.CLIENT_ID || 'urn:gov:gsa:openidconnect.profiles:sp:sso:opm_usds:smeqa_staging',
@@ -73,6 +76,7 @@ const headerTokens: { [tokenName: string]: string } = headerTokenString;

export { env };
export { dbURI };
export { dbDisableSSL };
export { openIdConfig };
export { sessionConfig };
export { headerTokens };
8 changes: 2 additions & 6 deletions api/src/database/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Sequelize, { QueryOptionsWithType, QueryTypes, Transaction } from 'sequelize';
import { dbURI, env } from '../config';
import { dbURI, env, dbDisableSSL } from '../config';
import { logger } from '../utils/logger';
import { initModels } from '../models/init-models';

@@ -43,11 +43,7 @@ export default class DB implements DBInterface {
dialect: "postgres",
// https://node-postgres.com/features/ssl
// https://sequelize.org/docs/v6/other-topics/dialect-specific-things/
dialectOptions: {
ssl:{
rejectUnauthorized: false,
}
}
dialectOptions: dbDisableSSL ? { ssl: false } : { ssl: { rejectUnauthorized: false } }
});
try {
initModels(this.sequelize);
9 changes: 3 additions & 6 deletions api/src/database/sessionDb.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Pool } from 'pg';
import { dbURI, env } from '../config';
import { dbURI, env, dbDisableSSL } from '../config';

// We had to change this out for the conn string in postgres 15+
// https://node-postgres.com/features/ssl
@@ -10,10 +10,7 @@ import { dbURI, env } from '../config';
max:20,
idleTimeoutMillis:60000,
connectionTimeoutMillis: 2000,
ssl:{
rejectUnauthorized: false
}

ssl: dbDisableSSL ? false : { rejectUnauthorized: false }
});
};
export default CreatePool;
export default CreatePool;
3 changes: 3 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -2,11 +2,13 @@ version: "3.7"

services:
api:
container_name: api
build:
context: api
dockerfile: Dockerfile.compose
environment:
- POSTGRES_URI=postgres://docker_pg_user:docker_pg_pw@db:5432/docker_db
- POSTGRES_DISABLE_SSL=true
- NODE_ENV=docker
- PORT=9000
- APP_ENV=docker
@@ -43,6 +45,7 @@ services:
depends_on:
- api
db:
container_name: db
image: postgres
environment:
- POSTGRES_DB=docker_db
2 changes: 1 addition & 1 deletion docs/Cold Start.md
Original file line number Diff line number Diff line change
@@ -47,7 +47,7 @@ To change your space or org for the cloud foundry session:
export POSTGRES=postgres://<USERNAME>:<PASSWORD>@localhost:<PORT>/<DB_NAME>
# You should only need to replace the URL with "localhost". The username, password, port, and db name should all work.
```
> Once this is done, you should be able to run `db/migrations.sh`
> Once this is done, you should be able to run `/db/migrations.sh`
9. Create the Admin token for uploads:
`$ cf set-env $APP_NAME ADMIN_TOKEN <RANDOM STRING>`
`$ cf restage $APP_NAME`
5 changes: 2 additions & 3 deletions frontend/src/App/Error/ErrorView.jsx
Original file line number Diff line number Diff line change
@@ -30,9 +30,8 @@ class ErrorPage extends React.Component {
return;
}

const primarySupportEmail = "kelvin.t.luu2@omb.eop.gov";
const secondarySupportEmails =
"william.slack@cms.hhs.gov";
const primarySupportEmail = "william.slack@gsa.gov";
const secondarySupportEmails ="";
const subject = "Resume Review - Support Request";
const messageBody = `Error ID: ${errorId}%0D%0A%0D%0APlease describe the error you encountered:`;
const mailToLink = `mailto:${primarySupportEmail}?subject=${subject}&cc=${secondarySupportEmails}&body=${messageBody}`;
5 changes: 2 additions & 3 deletions frontend/src/App/Error/index.jsx
Original file line number Diff line number Diff line change
@@ -23,9 +23,8 @@ const ErrorPage = () => {
return;
}

const primarySupportEmail = "kelvin.t.luu@omb.eop.gov";
const secondarySupportEmails =
"neil.s.sharma@omb.eop.gov;william.slack@cms.hhs.gov";
const primarySupportEmail = "william.slack@gsa.gov";
const secondarySupportEmails = "";
const subject = "Resume Review - Support Request";
const messageBody = `Error ID: ${errorId}%0D%0A%0D%0APlease describe the error you encountered:`;
const mailToLink = `mailto:${primarySupportEmail}?subject=${subject}&cc=${secondarySupportEmails}&body=${messageBody}`;
2 changes: 1 addition & 1 deletion frontend/src/App/LoginPage/index.jsx
Original file line number Diff line number Diff line change
@@ -110,7 +110,7 @@ class LoginPage extends React.Component {
required for the specified position. HR can review written
justification statements. If you have any trouble using this
website, please contact{" "}
<a href="mailto:kelvin.t.luu2@omb.eop.gov">Kelvin Luu</a>.
<a href="mailto:william.slack@gsa.gov">Will Slack</a>.
</p>
<div className="grid-col-3 smeqa-login-button">
{LoginButton}

0 comments on commit 939b614

Please sign in to comment.