@webqit/webflo 1.0.23 → 1.0.24
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,10 +200,10 @@ 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
208
|
});
|
|
209
209
|
console.log('Redis capabilities');
|
|
@@ -212,12 +212,12 @@ export class WebfloServer extends WebfloRuntime {
|
|
|
212
212
|
const { default: webpush } = await import('web-push');
|
|
213
213
|
console.log('Webpuah capabilities');
|
|
214
214
|
this.#sdk.webpush = webpush;
|
|
215
|
-
if (
|
|
216
|
-
&&
|
|
215
|
+
if (process.env[this.#cx.server.capabilities.vapid_public_key_variable]
|
|
216
|
+
&& process.env[this.#cx.server.capabilities.vapid_private_key_variable]) {
|
|
217
217
|
webpush.setVapidDetails(
|
|
218
218
|
this.#cx.server.capabilities.vapid_subject,
|
|
219
|
-
|
|
220
|
-
|
|
219
|
+
process.env[this.#cx.server.capabilities.vapid_public_key_variable],
|
|
220
|
+
process.env[this.#cx.server.capabilities.vapid_private_key_variable]
|
|
221
221
|
);
|
|
222
222
|
}
|
|
223
223
|
}
|
|
@@ -260,7 +260,7 @@ export class WebfloServer extends WebfloRuntime {
|
|
|
260
260
|
// Level 3 validation
|
|
261
261
|
// and actual processing
|
|
262
262
|
scope.request = this.createRequest(scope.url.href, requestInit);
|
|
263
|
-
scope.session = this.constructor.SessionStorage.create(scope.request, { secret:
|
|
263
|
+
scope.session = this.constructor.SessionStorage.create(scope.request, { secret: process.env[this.#cx.server.session_key_variable] });
|
|
264
264
|
if (!scope.error) {
|
|
265
265
|
if (!(scope.clientMessagingRegistry = this.#globalMessagingRegistry.get(scope.session.sessionID))) {
|
|
266
266
|
scope.error = `Lost or invalid clientID`;
|
|
@@ -560,7 +560,7 @@ export class WebfloServer extends WebfloRuntime {
|
|
|
560
560
|
scope.request = this.createRequest(scope.url.href, scope.init, scope.autoHeaders.filter((header) => header.type === 'request'));
|
|
561
561
|
scope.cookies = this.constructor.CookieStorage.create(scope.request);
|
|
562
562
|
scope.session = this.constructor.SessionStorage.create(scope.request, {
|
|
563
|
-
secret:
|
|
563
|
+
secret: process.env[this.#cx.server.session_key_variable],
|
|
564
564
|
registry: this.#sdk.redis && {
|
|
565
565
|
get: async (key) => { return await this.#sdk.redis.hgetall(key) },
|
|
566
566
|
set: async (key, value) => { return await this.#sdk.redis.hset(key, value) },
|