Update Deno, update Render deploy file

Fixes #33
Fixes #30 (hopefully, can't replicate)
This commit is contained in:
Bruno Bernardino
2024-12-26 11:46:45 +00:00
parent 24c0c41902
commit aaeaac0285
4 changed files with 32 additions and 13 deletions

2
.dvmrc
View File

@@ -1 +1 @@
2.1.2 2.1.4

View File

@@ -1,4 +1,4 @@
FROM denoland/deno:ubuntu-2.1.2 FROM denoland/deno:ubuntu-2.1.4
EXPOSE 8000 EXPOSE 8000

View File

@@ -33,6 +33,7 @@ export default class Database {
return this.db; return this.db;
} }
try {
const postgresClient = new Client({ const postgresClient = new Client({
user: POSTGRESQL_USER, user: POSTGRESQL_USER,
password: POSTGRESQL_PASSWORD, password: POSTGRESQL_PASSWORD,
@@ -45,6 +46,24 @@ export default class Database {
await postgresClient.connect(); await postgresClient.connect();
this.db = postgresClient; this.db = postgresClient;
} catch (error) {
// Try to connect without TLS, if the connection type is socket
if ((error as Error).toString().includes('No TLS options are allowed when host type is set to "socket"')) {
const postgresClient = new Client({
user: POSTGRESQL_USER,
password: POSTGRESQL_PASSWORD,
database: POSTGRESQL_DBNAME,
hostname: POSTGRESQL_HOST,
port: POSTGRESQL_PORT,
});
await postgresClient.connect();
this.db = postgresClient;
} else {
throw error;
}
}
} }
protected async disconnectFromPostgres() { protected async disconnectFromPostgres() {

View File

@@ -33,4 +33,4 @@ services:
databases: databases:
- name: bewcloud - name: bewcloud
plan: starter plan: basic-256mb