foxeld 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +20 -0
- package/src/index.ts +20 -0
- package/tsconfig.json +7 -0
package/package.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "foxeld",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"private": false,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "src/index.ts",
|
|
7
|
+
"publishConfig": {"access": "public"},
|
|
8
|
+
"types": "src/index.ts",
|
|
9
|
+
"scripts": {
|
|
10
|
+
"typecheck": "tsc --noEmit"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"dotenv": "^17.3.1",
|
|
14
|
+
"pg": "^8.20.0"
|
|
15
|
+
},
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"@types/pg": "^8.18.0",
|
|
18
|
+
"typescript": "^5.9.3"
|
|
19
|
+
}
|
|
20
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { config as loadEnv } from "dotenv";
|
|
2
|
+
import { Pool } from "pg";
|
|
3
|
+
|
|
4
|
+
loadEnv();
|
|
5
|
+
|
|
6
|
+
function requireEnv(name: string): string {
|
|
7
|
+
const value = process.env[name];
|
|
8
|
+
if (!value) {
|
|
9
|
+
throw new Error(`Missing environment variable: ${name}`);
|
|
10
|
+
}
|
|
11
|
+
return value;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function createBusinessPool(): Pool {
|
|
15
|
+
return new Pool({ connectionString: requireEnv("BUSINESS_DATABASE_URL") });
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function createEventsPool(): Pool {
|
|
19
|
+
return new Pool({ connectionString: requireEnv("EVENTS_DATABASE_URL") });
|
|
20
|
+
}
|