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

Connecting to Sequelize with a URL #789

Closed
PatrickKelly opened this issue Jan 13, 2022 · 1 comment
Closed

Connecting to Sequelize with a URL #789

PatrickKelly opened this issue Jan 13, 2022 · 1 comment

Comments

@PatrickKelly
Copy link

PatrickKelly commented Jan 13, 2022

Is it possible to use a database URL or connection string to initialize Sequelize?

The docs show this, but if many of our environments we use a string provided through an environment variable:

  imports: [
    ConfigModule.forRoot(),
    SequelizeModule.forRoot({
      dialect: 'postgres',
      host: process.env.DATABASE_HOST,
      port: parseInt(process.env.DATABASE_PORT, 10),
      username: process.env.DATABASE_USER,
      password: process.env.DATABASE_PWD,
      database: process.env.DATABASE_DB,
      logging: process.env.DATABASE_ENABLE_LOGGING === 'true',
      ssl: process.env.DATABASE_REQUIRE_SSL === 'true',
    }),
  ],
  controllers: [StatusController],
  providers: [],
})```
@kamilmysliwiec
Copy link
Member

Please, use our Discord channel (support) for such questions. We are using GitHub to track bugs, feature requests, and potential improvements.

@nestjs nestjs locked and limited conversation to collaborators Jan 13, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants