Skip to content

Commit

Permalink
fix(server): ensure db env var for local development
Browse files Browse the repository at this point in the history
  • Loading branch information
neuodev committed Aug 2, 2024
1 parent 9f98a21 commit 97f1889
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@ Check [DrawSQL](https://drawsql.app/teams/no-sim/diagrams/space)

- [`pg`](https://node-postgres.com/)
- [`node-pg-migrate`](https://salsita.github.io/node-pg-migrate/getting-started)

https://gist.github.com/Oleshkooo/a403dc8b85e98070fb39844dfb3c0208
https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-ubuntu-16-04
https://docs.vultr.com/how-to-configure-apache-as-a-reverse-proxy-with-mod-proxy-54152
10 changes: 5 additions & 5 deletions server/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ const schema = {
} as const;

export const databaseConnection = {
user: isDev ? "postgres" : schema.string.parse(process.env.PG_USER),
password: isDev ? "litespace" : schema.string.parse(process.env.PG_PASSWORD),
host: isDev ? "localhost" : schema.string.parse(process.env.PG_HOST),
port: isDev ? 5432 : schema.number.parse(process.env.PG_PORT),
database: isDev ? "litespace" : schema.string.parse(process.env.PG_DATABASE),
user: schema.string.parse(process.env.PG_USER),
password: schema.string.parse(process.env.PG_PASSWORD),
host: schema.string.parse(process.env.PG_HOST),
port: zod.coerce.number().parse(process.env.PG_PORT),
database: schema.string.parse(process.env.PG_DATABASE),
url: zod
.string({ message: "Missing or invalid database url" })
.startsWith("postgres://")
Expand Down

0 comments on commit 97f1889

Please sign in to comment.