@webqit/webflo 1.0.23 → 1.0.25
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
CHANGED
|
@@ -182,13 +182,13 @@ export class WebfloServer extends WebfloRuntime {
|
|
|
182
182
|
if (this.#cx.server.capabilities.database_dialect !== 'postgres') {
|
|
183
183
|
throw new Error(`Only postgres supported for now for database dialect`);
|
|
184
184
|
}
|
|
185
|
-
if (
|
|
185
|
+
if (process.env[this.#cx.server.capabilities.database_url_variable]) {
|
|
186
186
|
console.log('Database capabilities');
|
|
187
187
|
const { SQLClient } = await import('@linked-db/linked-ql/sql');
|
|
188
188
|
const { default: pg } = await import('pg');
|
|
189
189
|
// Obtain pg client
|
|
190
190
|
const pgClient = new pg.Pool({
|
|
191
|
-
connectionString:
|
|
191
|
+
connectionString: process.env[this.#cx.server.capabilities.database_url_variable],
|
|
192
192
|
database: 'postgres',
|
|
193
193
|
});
|
|
194
194
|
// Connect
|
|
@@ -200,11 +200,12 @@ export class WebfloServer extends WebfloRuntime {
|
|
|
200
200
|
//this.#sdk.db = new ODBClient({ dialect: 'postgres' });
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
|
-
if (this.#cx.server.capabilities?.redis &&
|
|
203
|
+
if (this.#cx.server.capabilities?.redis && process.env[this.#cx.server.capabilities.redis_url_variable]) {
|
|
204
204
|
const { Redis } = await import('ioredis');
|
|
205
|
-
this.#sdk.redis = !
|
|
206
|
-
? new Redis : new Redis(
|
|
205
|
+
this.#sdk.redis = !process.env[this.#cx.server.capabilities.redis_url_variable]
|
|
206
|
+
? new Redis : new Redis(process.env[this.#cx.server.capabilities.redis_url_variable], {
|
|
207
207
|
tls: { rejectUnauthorized: false }, // Required for Upstash
|
|
208
|
+
family: 6
|
|
208
209
|
});
|
|
209
210
|
console.log('Redis capabilities');
|
|
210
211
|
}
|
|
@@ -212,12 +213,12 @@ export class WebfloServer extends WebfloRuntime {
|
|
|
212
213
|
const { default: webpush } = await import('web-push');
|
|
213
214
|
console.log('Webpuah capabilities');
|
|
214
215
|
this.#sdk.webpush = webpush;
|
|
215
|
-
if (
|
|
216
|
-
&&
|
|
216
|
+
if (process.env[this.#cx.server.capabilities.vapid_public_key_variable]
|
|
217
|
+
&& process.env[this.#cx.server.capabilities.vapid_private_key_variable]) {
|
|
217
218
|
webpush.setVapidDetails(
|
|
218
219
|
this.#cx.server.capabilities.vapid_subject,
|
|
219
|
-
|
|
220
|
-
|
|
220
|
+
process.env[this.#cx.server.capabilities.vapid_public_key_variable],
|
|
221
|
+
process.env[this.#cx.server.capabilities.vapid_private_key_variable]
|
|
221
222
|
);
|
|
222
223
|
}
|
|
223
224
|
}
|
|
@@ -260,7 +261,7 @@ export class WebfloServer extends WebfloRuntime {
|
|
|
260
261
|
// Level 3 validation
|
|
261
262
|
// and actual processing
|
|
262
263
|
scope.request = this.createRequest(scope.url.href, requestInit);
|
|
263
|
-
scope.session = this.constructor.SessionStorage.create(scope.request, { secret:
|
|
264
|
+
scope.session = this.constructor.SessionStorage.create(scope.request, { secret: process.env[this.#cx.server.session_key_variable] });
|
|
264
265
|
if (!scope.error) {
|
|
265
266
|
if (!(scope.clientMessagingRegistry = this.#globalMessagingRegistry.get(scope.session.sessionID))) {
|
|
266
267
|
scope.error = `Lost or invalid clientID`;
|
|
@@ -560,7 +561,7 @@ export class WebfloServer extends WebfloRuntime {
|
|
|
560
561
|
scope.request = this.createRequest(scope.url.href, scope.init, scope.autoHeaders.filter((header) => header.type === 'request'));
|
|
561
562
|
scope.cookies = this.constructor.CookieStorage.create(scope.request);
|
|
562
563
|
scope.session = this.constructor.SessionStorage.create(scope.request, {
|
|
563
|
-
secret:
|
|
564
|
+
secret: process.env[this.#cx.server.session_key_variable],
|
|
564
565
|
registry: this.#sdk.redis && {
|
|
565
566
|
get: async (key) => { return await this.#sdk.redis.hgetall(key) },
|
|
566
567
|
set: async (key, value) => { return await this.#sdk.redis.hset(key, value) },
|