Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Untangle the DB_TYPE env var logic #40

Open
wants to merge 1 commit into
base: feature/surf
Choose a base branch
from

Conversation

berkes
Copy link

@berkes berkes commented Jan 29, 2025

This logic caused issues when running:

  • The defaults in .env.example are wrong.
  • The logic sets the DB_TYPE var based on the DB_URL. But this var is not required nor documented. Nor edge-cases like "psql://" etc etc are covered.
  • Just enforcing DB_TYPE is much easier.
  • We don't support anything else then postgres (and not postgresql, as the error in our typeOrmDateTime says!) so there's no need for logic to support other database types anyway.
  • We must set DB_TYPE, because libs like typeOrmDateTime read it from process.env on their own, and not from passed in config. So these libs require this ENV var to be present. So we cannot simply hardcoded it.

This logic caused issues when running:

- The defaults in .env.example are wrong.
- The logic sets the DB_TYPE var based on the DB_URL. But this var is not
  required nor documented. Nor edge-cases like "psql://" etc etc are
  covered.
- Just enforcing DB_TYPE is much easier.
- We don't support anything else then postgres (and not postgresql, as
  the error in our typeOrmDateTime says!) so there's no need for logic
  to support other database types anyway.
- We must set DB_TYPE, because libs like typeOrmDateTime read it from
  process.env on their own, and not from passed in config. So these libs
  require this ENV var to be present. So we cannot simply hardcoded it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant