Skip to content

Commit

Permalink
chore: create .env.test for testing env vars
Browse files Browse the repository at this point in the history
  • Loading branch information
aleortega committed Oct 7, 2024
1 parent 01b1b1d commit 12a10e9
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 16 deletions.
15 changes: 8 additions & 7 deletions api/.env.default
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
HTTP_SERVER_PORT=3000
HTTP_SERVER_HOST=0.0.0.0
# values from docker compose
PG_COMPONENT_PSQL_PORT='5450'
PG_COMPONENT_PSQL_HOST='localhost'
PG_COMPONENT_PSQL_DATABASE='badges'
PG_COMPONENT_PSQL_USER='postgres'
PG_COMPONENT_PSQL_PASSWORD='pass1234'
CDN_HOST='https://host.tld'

# PG_COMPONENT_PSQL_PORT=''
# PG_COMPONENT_PSQL_HOST=''
# PG_COMPONENT_PSQL_DATABASE=''
# PG_COMPONENT_PSQL_USER=''
# PG_COMPONENT_PSQL_PASSWORD=''

# CDN_HOST=''
10 changes: 10 additions & 0 deletions api/.env.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
HTTP_SERVER_PORT=3000
HTTP_SERVER_HOST=0.0.0.0

PG_COMPONENT_PSQL_PORT='5450'
PG_COMPONENT_PSQL_HOST='localhost'
PG_COMPONENT_PSQL_DATABASE='badges'
PG_COMPONENT_PSQL_USER='postgres'
PG_COMPONENT_PSQL_PASSWORD='pass1234'

CDN_HOST='https://host.tld'
2 changes: 1 addition & 1 deletion api/test/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const test = createRunner<TestComponents>({
async function initComponents(): Promise<TestComponents> {
const components = await originalInitComponents()

const config = await createDotEnvConfigComponent({ path: ['.env.default'] })
const config = await createDotEnvConfigComponent({ path: ['.env.test'] })

let databaseUrl: string | undefined = await config.getString('PG_COMPONENT_PSQL_CONNECTION_STRING')
if (!databaseUrl) {
Expand Down
14 changes: 7 additions & 7 deletions processor/.env.default
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# values from docker compose
PG_COMPONENT_PSQL_PORT='5450'
PG_COMPONENT_PSQL_HOST='localhost'
PG_COMPONENT_PSQL_DATABASE='badges'
PG_COMPONENT_PSQL_USER='postgres'
PG_COMPONENT_PSQL_PASSWORD='pass1234'
CDN_HOST='https://host.tld'
# PG_COMPONENT_PSQL_PORT=''
# PG_COMPONENT_PSQL_HOST=''
# PG_COMPONENT_PSQL_DATABASE=''
# PG_COMPONENT_PSQL_USER=''
# PG_COMPONENT_PSQL_PASSWORD=''

# CDN_HOST=''
# AWS_SNS_ARN=''
# AWS_SNS_ENDPOINT=''
# AWS_SQS_ENDPOINT=''
7 changes: 7 additions & 0 deletions processor/.env.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
PG_COMPONENT_PSQL_PORT='5450'
PG_COMPONENT_PSQL_HOST='localhost'
PG_COMPONENT_PSQL_DATABASE='badges'
PG_COMPONENT_PSQL_USER='postgres'
PG_COMPONENT_PSQL_PASSWORD='pass1234'

CDN_HOST='https://any-host.tld'
2 changes: 1 addition & 1 deletion processor/test/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const test = createRunner<TestComponents>({
async function initComponents(): Promise<TestComponents> {
const components = await originalInitComponents()

const config = await createDotEnvConfigComponent({ path: ['.env.default'] })
const config = await createDotEnvConfigComponent({ path: ['.env.test'] })

return {
...components,
Expand Down

0 comments on commit 12a10e9

Please sign in to comment.