Skip to content

Refactor @module/database to not read env vars at module level #116

@Soulike

Description

@Soulike

Problem

@module/database reads DB_PASSWORD_FILE from process.env at module load time and throws if it's missing. This creates an implicit requirement: any package that depends on @module/database (directly or transitively) must have DB_PASSWORD_FILE set, even if it doesn't directly use the database connection.

This caused a startup crash in the auth server (fixed in #115), which depends on @module/database but had no DB_PASSWORD_FILE configured.

Suggestion

Make database configuration explicit — accept config/credentials as parameters during initialization rather than reading env vars at the module level. This way the consuming app controls where credentials come from and the dependency is visible, not hidden.

File

  • modules/server/database/src/pool/config.ts

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions