chore: remove proprietary README.md and add database connection logic in index.ts

This commit is contained in:
Mauricio Siu
2026-02-28 11:14:12 -06:00
parent 9f3356ddb4
commit 2a5d3975e8
2 changed files with 38 additions and 18 deletions

View File

@@ -1,18 +0,0 @@
# Proprietary Features
This directory contains all proprietary functionality of Dokploy.
## Purpose
This folder will house all **paid features** and premium functionality that are not part of the open source code.
## License
The code in this directory is under Dokploy's proprietary license. See [LICENSE_PROPRIETARY.md](../../../LICENSE_PROPRIETARY.md) for more details.
## Contact
If you want to learn more about our paid features or have any questions, please contact us at:
- Email: [sales@dokploy.com](mailto:sales@dokploy.com)
- Contact Form: [https://dokploy.com/contact](https://dokploy.com/contact)

View File

@@ -0,0 +1,38 @@
import { dbUrl } from "@dokploy/server/db/constants";
import * as schema from "@dokploy/server/db/schema";
import { and, eq } from "drizzle-orm";
import { drizzle, type PostgresJsDatabase } from "drizzle-orm/postgres-js";
import postgres from "postgres";
export { and, eq };
type Database = PostgresJsDatabase<typeof schema>;
/**
* Evita problemas de redeclaración global en monorepos.
* No usamos `declare global`.
*/
const globalForDb = globalThis as unknown as {
db?: Database;
};
let dbConnection: Database;
if (process.env.NODE_ENV === "production") {
// En producción no usamos global cache
dbConnection = drizzle(postgres(dbUrl), {
schema,
});
} else {
// En desarrollo reutilizamos conexión para evitar múltiples conexiones
if (!globalForDb.db) {
globalForDb.db = drizzle(postgres(dbUrl), {
schema,
});
}
dbConnection = globalForDb.db;
}
export const db: Database = dbConnection;
export { dbUrl };