feat: update Docker setup and documentation for PostgreSQL integration
This commit is contained in:
1 parent
f56eac28f7
commit
14a7348632
7 files changed
+46
-130
No files matched your search
@@ -36,17 +36,10 @@ class PostgresAdapter implements DBAdapter {
|
||||
// OID 20 = INT8, OID 1700 = NUMERIC (keep default for now)
|
||||
pgTypes.setTypeParser(20, (val: string) => parseInt(val, 10));
|
||||
const connectionString = process.env.DATABASE_URL;
|
||||
if (connectionString) {
|
||||
this.pool = new Pool({ connectionString });
|
||||
} else {
|
||||
this.pool = new Pool({
|
||||
host: process.env.PGHOST || 'localhost',
|
||||
port: parseInt(process.env.PGPORT || '5432', 10),
|
||||
user: process.env.PGUSER || 'postgres',
|
||||
password: process.env.PGPASSWORD || '',
|
||||
database: process.env.PGDATABASE || 'collabtable'
|
||||
});
|
||||
if (!connectionString) {
|
||||
throw new Error('DATABASE_URL environment variable is required');
|
||||
}
|
||||
this.pool = new Pool({ connectionString });
|
||||
}
|
||||
|
||||
async initialize(): Promise<void> {
|
||||
|
||||
@@ -102,8 +102,7 @@ app.use('/', webRoutes);
|
||||
app.listen(PORT, () => {
|
||||
console.log(`Server is running on port ${PORT}`);
|
||||
console.log(`Environment: ${process.env.NODE_ENV || 'development'}`);
|
||||
const source = process.env.DATABASE_URL ? 'DATABASE_URL' : 'PGHOST/PGDATABASE';
|
||||
console.log(`Database: PostgreSQL (${source})`);
|
||||
console.log('Database: PostgreSQL (DATABASE_URL)');
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('Database initialization error:', error);
|
||||
|
||||
Reference in new issue
Block a user