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

enhancement(NOC-1919) add database check on application start up #8

Closed
wants to merge 42 commits into from

Conversation

dmmc12
Copy link
Collaborator

@dmmc12 dmmc12 commented Mar 21, 2024

Scope

Test database start up behaviour to ensure errors are captured correctly so the end user is aware of potential configuration issues.

Implementation

postgres.ts contains the constructor for creating the chatbot pool.

I've duplicated this code in application.ts and created two new functions called setupDatabaseConnection and ensureDatabaseConnection.

These two functions are used at application startup to check that you can connect to the database ai_chatbot correctly and console logged to the terminal.

17:15:18 - Starting compilation in watch mode...


17:15:19 - Found 0 errors. Watching for file changes.
Successfully connected to the database: ai_chatbot at localhost:5432
Server running on http (port 3000)

If I mistakenly use the wrong port, user, database, host or password, you will see the error console logged.

Example

17:15:58 - Starting compilation in watch mode...


17:15:59 - Found 0 errors. Watching for file changes.
Failed to establish a database connection: password authentication failed for user "ai_chatbot"

I believe it to be necessary to ensure checks are done on database connectivity but I would appreciate confirmation on whether duplicating the code was the incorrect choice here or if you have preferred suggestions.

ciaranjmp and others added 30 commits March 14, 2024 12:29
Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.15.5 to 1.15.6.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](follow-redirects/follow-redirects@v1.15.5...v1.15.6)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
task(NOC-1913): moving from "paragraph" terminology to "chunk"
#5)

* task(NOC-1914): added describe functionality for all supported file types & cleaned up telnyx context class

* fix(NOC-1914): improved describe functionality for JSON/CSV files
…-redirects-1.15.6

build(deps): bump follow-redirects from 1.15.5 to 1.15.6
…. Add a check that the environment variables specified all contain values
Tests are added for following endpoints:
1. `/completions`
2. `/state`
3. `/pricing/model`
4. `/pricing/model/cost`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants