-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Postgres Terraform config + app wiring
- Loading branch information
1 parent
e217878
commit 36fafa5
Showing
7 changed files
with
77 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,21 @@ | ||
import { createCustomServer } from './server'; | ||
import { createCustomServer } from './server.js'; | ||
|
||
const port = process.env.PORT || 4321; | ||
const app = await createCustomServer(); | ||
|
||
app.listen(port, () => { | ||
console.log(`Server running on http://localhost:${port}`); | ||
}); | ||
const getCloudGovServerSecrets = () => { | ||
if (process.env.VCAP_SERVICES === undefined) { | ||
throw new Error('VCAP_SERVICES not found'); | ||
} | ||
const services = JSON.parse(process.env.VCAP_SERVICES || '{}'); | ||
return { | ||
//loginGovClientSecret: services['user-provided']?.credentials?.SECRET_LOGIN_GOV_PRIVATE_KEY, | ||
dbUri: services['aws-rds'].credentials.uri as string, | ||
}; | ||
}; | ||
|
||
const secrets = getCloudGovServerSecrets(); | ||
createCustomServer({ dbUri: secrets?.dbUri }).then((server: any) => | ||
server.listen(port, () => { | ||
console.log(`Server running on http://localhost:${port}`); | ||
}) | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,20 @@ | ||
import request from 'supertest'; | ||
import { beforeAll, describe, expect, test } from 'vitest'; | ||
import { describe, expect, test } from 'vitest'; | ||
import { describeDatabase } from '@atj/database/testing'; | ||
|
||
import { createCustomServer } from '../src/server'; | ||
|
||
describe('Kansas State Courts Form Service', () => { | ||
let app: any; | ||
|
||
beforeAll(async () => { | ||
app = await createCustomServer(); | ||
describe('DOJ Form Service', () => { | ||
test('avoid "No test suite found in file" error', async () => { | ||
expect(true).toBe(true); | ||
}); | ||
}); | ||
|
||
test('renders the home page', async () => { | ||
describeDatabase('Kansas State Courts Form Service', () => { | ||
test('renders the home page', async ({ db }) => { | ||
const app = await createCustomServer({ dbUri: db.ctx.connectionUri }); | ||
const response = await request(app).get('/'); | ||
expect(response.ok).toBe(true); | ||
expect(response.text).toMatch(/KS Courts Form Service/); | ||
expect(response.text).toMatch(/DOJ Form Service/); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters