UNCLASSIFIED - NO CUI

Skip to content
Snippets Groups Projects
Commit 0e8e8f59 authored by Douglas Lagemann's avatar Douglas Lagemann
Browse files

Merge branch 'BULL-3251_db_migration' into 'main'

BULL-3251, BULL-3249: Database migration/environment variables

See merge request !5
parents 85fe5576 dd4cbc0f
No related branches found
No related tags found
1 merge request!5BULL-3251, BULL-3249: Database migration/environment variables
...@@ -20,6 +20,31 @@ exports.runMigrations = async () => { ...@@ -20,6 +20,31 @@ exports.runMigrations = async () => {
await client.end(); await client.end();
} }
/**
* Check connectivity with the database and report results.
*/
exports.healthCheck = async () => {
try {
const client = new Client({
connectionString,
});
await client.connect();
await client.end();
} catch (err) {
console.log(`Database connection error during health check: ${err}`);
return {
status: 500,
message: "Internal Server Error"
};
}
return {
status: 200,
message: "Database connection succeeded. Health check passed."
};
}
/** /**
* Return the version number stored in the database. * Return the version number stored in the database.
*/ */
......
...@@ -28,7 +28,7 @@ services: ...@@ -28,7 +28,7 @@ services:
db: db:
condition: service_healthy condition: service_healthy
healthcheck: healthcheck:
test: curl -f http://localhost:$$PORT/health test: curl -f http://localhost:$$PORT/api/health
timeout: 10s timeout: 10s
retries: 5 retries: 5
profiles: profiles:
......
...@@ -24,10 +24,6 @@ apiTemplates: ...@@ -24,10 +24,6 @@ apiTemplates:
repositoryId: "16614" repositoryId: "16614"
formulaFilePath: "formulas/api/golang.yml" formulaFilePath: "formulas/api/golang.yml"
- name: "NewProject DontPickMe"
repositoryId: "16613"
formulaFilePath: "formulas/api/express.yml"
dbTemplates: dbTemplates:
- name: "None" - name: "None"
repositoryId: "" repositoryId: ""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment