@hotmeshio/long-tail 0.4.9 → 0.4.10

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.
@@ -37,33 +37,44 @@ exports.applyDatabaseConfig = applyDatabaseConfig;
37
37
  exports.applyServerAuthConfig = applyServerAuthConfig;
38
38
  const config_1 = require("../modules/config");
39
39
  const auth_1 = require("../modules/auth");
40
+ const logger_1 = require("../lib/logger");
40
41
  /**
41
42
  * Apply database connection settings from the startup config
42
43
  * to the shared postgres_options object.
43
44
  */
44
45
  function applyDatabaseConfig(db) {
45
46
  if (db.connectionString) {
46
- Object.assign(config_1.postgres_options, {
47
- connectionString: db.connectionString,
48
- host: undefined,
49
- port: undefined,
50
- user: undefined,
51
- password: undefined,
52
- database: undefined,
53
- });
47
+ // Infer SSL from sslmode in connection string when not explicitly provided
48
+ if (!db.ssl) {
49
+ try {
50
+ const sslmode = new URL(db.connectionString).searchParams.get('sslmode');
51
+ if (sslmode === 'require') {
52
+ config_1.postgres_options.ssl = { rejectUnauthorized: false };
53
+ logger_1.loggerRegistry.info('[long-tail] database SSL inferred from sslmode=require');
54
+ }
55
+ }
56
+ catch { /* not a parseable URL — skip inference */ }
57
+ }
58
+ // Clear individual fields — connectionString takes precedence.
59
+ // Delete stale keys so pg doesn't see conflicting host/port/etc.
60
+ delete config_1.postgres_options.host;
61
+ delete config_1.postgres_options.port;
62
+ delete config_1.postgres_options.user;
63
+ delete config_1.postgres_options.password;
64
+ delete config_1.postgres_options.database;
65
+ config_1.postgres_options.connectionString = db.connectionString;
54
66
  }
55
67
  else {
56
- Object.assign(config_1.postgres_options, {
57
- host: db.host ?? config_1.postgres_options.host,
58
- port: db.port ?? config_1.postgres_options.port,
59
- user: db.user ?? config_1.postgres_options.user,
60
- password: db.password ?? config_1.postgres_options.password,
61
- database: db.database ?? config_1.postgres_options.database,
62
- });
68
+ config_1.postgres_options.host = db.host ?? config_1.postgres_options.host;
69
+ config_1.postgres_options.port = db.port ?? config_1.postgres_options.port;
70
+ config_1.postgres_options.user = db.user ?? config_1.postgres_options.user;
71
+ config_1.postgres_options.password = db.password ?? config_1.postgres_options.password;
72
+ config_1.postgres_options.database = db.database ?? config_1.postgres_options.database;
63
73
  }
64
74
  // SSL passthrough — applies to both connectionString and individual-field modes
65
75
  if (db.ssl !== undefined) {
66
76
  config_1.postgres_options.ssl = db.ssl;
77
+ logger_1.loggerRegistry.info(`[long-tail] database SSL configured: ${typeof db.ssl === 'object' ? JSON.stringify(db.ssl) : db.ssl}`);
67
78
  }
68
79
  }
69
80
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hotmeshio/long-tail",
3
- "version": "0.4.9",
3
+ "version": "0.4.10",
4
4
  "description": "Long Tail Workflows — Durable AI workflows with human-in-the-loop escalation. Powered by PostgreSQL.",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",