Skip to content

fix: replace hardcoded Postgres config in examples with environment variables #35

@PaulGrimshaw

Description

@PaulGrimshaw

Problem

Both example applications hardcode Postgres connection details in index.ts:

const postgresConfig = {
    host: "localhost",
    port: 5432,
    user: "postgres",
    password: "postgres",
    database: "dcb_test_1"
}

This doesn't work out of the box for anyone with a different local setup and is a bad pattern to model in example code.

Fix

  • Read connection details from environment variables (or a DATABASE_URL connection string)
  • Add a .env.example file to each example with documented defaults
  • Add .env to .gitignore
  • Update the example README (or root README) to explain how to configure the examples

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions