@tmlmobilidade/databases 20260330.1735.58 → 20260331.1620.53

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.
@@ -2,6 +2,7 @@
2
2
  import { createClient } from '@clickhouse/client';
3
3
  import { Logger } from '@tmlmobilidade/logger';
4
4
  import { SshTunnelService } from '@tmlmobilidade/ssh';
5
+ import { readFileSync } from 'node:fs';
5
6
  /* * */
6
7
  export class GOClickHouseClient {
7
8
  //
@@ -42,7 +43,10 @@ export class GOClickHouseClient {
42
43
  async connect() {
43
44
  Logger.info('[GOClickHouseClient] Connecting to database...');
44
45
  const connectionString = await this.getConnectionString();
45
- this.client = createClient({ url: connectionString });
46
+ this.client = createClient({
47
+ keep_alive: { enabled: false },
48
+ url: connectionString,
49
+ });
46
50
  }
47
51
  /**
48
52
  * Constructs the connection string based on environment variables
@@ -83,11 +87,12 @@ export class GOClickHouseClient {
83
87
  port: Number(process.env.GO_CLICKHOUSE_TUNNEL_LOCAL_PORT),
84
88
  },
85
89
  sshOptions: {
86
- agent: process.env.SSH_AUTH_SOCK,
90
+ agent: process.env.GO_CLICKHOUSE_TUNNEL_SSH_KEY_PATH ? undefined : process.env.SSH_AUTH_SOCK,
87
91
  host: process.env.GO_CLICKHOUSE_TUNNEL_SSH_HOST,
88
92
  keepaliveCountMax: 20,
89
93
  keepaliveInterval: 10_000,
90
94
  port: 22,
95
+ privateKey: process.env.GO_CLICKHOUSE_TUNNEL_SSH_KEY_PATH ? readFileSync(process.env.GO_CLICKHOUSE_TUNNEL_SSH_KEY_PATH) : undefined,
91
96
  username: process.env.GO_CLICKHOUSE_TUNNEL_SSH_USERNAME,
92
97
  },
93
98
  tunnelOptions: {
@@ -2,6 +2,7 @@
2
2
  import { Logger } from '@tmlmobilidade/logger';
3
3
  import { SshTunnelService } from '@tmlmobilidade/ssh';
4
4
  import { MongoClient } from 'mongodb';
5
+ import { readFileSync } from 'node:fs';
5
6
  /* * */
6
7
  export class GOMongoClient {
7
8
  //
@@ -103,11 +104,12 @@ export class GOMongoClient {
103
104
  port: Number(process.env.GO_MONGO_TUNNEL_LOCAL_PORT),
104
105
  },
105
106
  sshOptions: {
106
- agent: process.env.SSH_AUTH_SOCK,
107
+ agent: process.env.GO_MONGO_TUNNEL_SSH_KEY_PATH ? undefined : process.env.SSH_AUTH_SOCK,
107
108
  host: process.env.GO_MONGO_TUNNEL_SSH_HOST,
108
109
  keepaliveCountMax: 3,
109
110
  keepaliveInterval: 10_000,
110
111
  port: 22,
112
+ privateKey: process.env.GO_MONGO_TUNNEL_SSH_KEY_PATH ? readFileSync(process.env.GO_MONGO_TUNNEL_SSH_KEY_PATH) : undefined,
111
113
  username: process.env.GO_MONGO_TUNNEL_SSH_USERNAME,
112
114
  },
113
115
  tunnelOptions: {
@@ -2,6 +2,7 @@
2
2
  import { Logger } from '@tmlmobilidade/logger';
3
3
  import { SshTunnelService } from '@tmlmobilidade/ssh';
4
4
  import { MongoClient } from 'mongodb';
5
+ import { readFileSync } from 'node:fs';
5
6
  /* * */
6
7
  export class PCGIFileManagerClient {
7
8
  //
@@ -103,11 +104,12 @@ export class PCGIFileManagerClient {
103
104
  port: Number(process.env.PCGI_FILE_MANAGER_TUNNEL_LOCAL_PORT),
104
105
  },
105
106
  sshOptions: {
106
- agent: process.env.SSH_AUTH_SOCK,
107
+ agent: process.env.PCGI_FILE_MANAGER_TUNNEL_SSH_KEY_PATH ? undefined : process.env.SSH_AUTH_SOCK,
107
108
  host: process.env.PCGI_FILE_MANAGER_TUNNEL_SSH_HOST,
108
109
  keepaliveCountMax: 3,
109
110
  keepaliveInterval: 10_000,
110
111
  port: 22,
112
+ privateKey: process.env.PCGI_FILE_MANAGER_TUNNEL_SSH_KEY_PATH ? readFileSync(process.env.PCGI_FILE_MANAGER_TUNNEL_SSH_KEY_PATH) : undefined,
111
113
  username: process.env.PCGI_FILE_MANAGER_TUNNEL_SSH_USERNAME,
112
114
  },
113
115
  tunnelOptions: {
@@ -2,6 +2,7 @@
2
2
  import { Logger } from '@tmlmobilidade/logger';
3
3
  import { SshTunnelService } from '@tmlmobilidade/ssh';
4
4
  import { MongoClient } from 'mongodb';
5
+ import { readFileSync } from 'node:fs';
5
6
  /* * */
6
7
  export class PCGIRawClient {
7
8
  //
@@ -103,11 +104,12 @@ export class PCGIRawClient {
103
104
  port: Number(process.env.PCGI_RAW_TUNNEL_LOCAL_PORT),
104
105
  },
105
106
  sshOptions: {
106
- agent: process.env.SSH_AUTH_SOCK,
107
+ agent: process.env.PCGI_RAW_TUNNEL_SSH_KEY_PATH ? undefined : process.env.SSH_AUTH_SOCK,
107
108
  host: process.env.PCGI_RAW_TUNNEL_SSH_HOST,
108
109
  keepaliveCountMax: 3,
109
110
  keepaliveInterval: 10_000,
110
111
  port: 22,
112
+ privateKey: process.env.PCGI_RAW_TUNNEL_SSH_KEY_PATH ? readFileSync(process.env.PCGI_RAW_TUNNEL_SSH_KEY_PATH) : undefined,
111
113
  username: process.env.PCGI_RAW_TUNNEL_SSH_USERNAME,
112
114
  },
113
115
  tunnelOptions: {
@@ -2,6 +2,7 @@
2
2
  import { Logger } from '@tmlmobilidade/logger';
3
3
  import { SshTunnelService } from '@tmlmobilidade/ssh';
4
4
  import { MongoClient } from 'mongodb';
5
+ import { readFileSync } from 'node:fs';
5
6
  /* * */
6
7
  export class PCGITicketingClient {
7
8
  //
@@ -103,11 +104,12 @@ export class PCGITicketingClient {
103
104
  port: Number(process.env.PCGI_TICKETING_TUNNEL_LOCAL_PORT),
104
105
  },
105
106
  sshOptions: {
106
- agent: process.env.SSH_AUTH_SOCK,
107
+ agent: process.env.PCGI_TICKETING_TUNNEL_SSH_KEY_PATH ? undefined : process.env.SSH_AUTH_SOCK,
107
108
  host: process.env.PCGI_TICKETING_TUNNEL_SSH_HOST,
108
109
  keepaliveCountMax: 3,
109
110
  keepaliveInterval: 10_000,
110
111
  port: 22,
112
+ privateKey: process.env.PCGI_TICKETING_TUNNEL_SSH_KEY_PATH ? readFileSync(process.env.PCGI_TICKETING_TUNNEL_SSH_KEY_PATH) : undefined,
111
113
  username: process.env.PCGI_TICKETING_TUNNEL_SSH_USERNAME,
112
114
  },
113
115
  tunnelOptions: {
@@ -2,6 +2,7 @@
2
2
  import { Logger } from '@tmlmobilidade/logger';
3
3
  import { SshTunnelService } from '@tmlmobilidade/ssh';
4
4
  import { MongoClient } from 'mongodb';
5
+ import { readFileSync } from 'node:fs';
5
6
  /* * */
6
7
  export class PCGIValidationsClient {
7
8
  //
@@ -103,11 +104,12 @@ export class PCGIValidationsClient {
103
104
  port: Number(process.env.PCGI_VALIDATIONS_TUNNEL_LOCAL_PORT),
104
105
  },
105
106
  sshOptions: {
106
- agent: process.env.SSH_AUTH_SOCK,
107
+ agent: process.env.PCGI_VALIDATIONS_TUNNEL_SSH_KEY_PATH ? undefined : process.env.SSH_AUTH_SOCK,
107
108
  host: process.env.PCGI_VALIDATIONS_TUNNEL_SSH_HOST,
108
109
  keepaliveCountMax: 3,
109
110
  keepaliveInterval: 10_000,
110
111
  port: 22,
112
+ privateKey: process.env.PCGI_VALIDATIONS_TUNNEL_SSH_KEY_PATH ? readFileSync(process.env.PCGI_VALIDATIONS_TUNNEL_SSH_KEY_PATH) : undefined,
111
113
  username: process.env.PCGI_VALIDATIONS_TUNNEL_SSH_USERNAME,
112
114
  },
113
115
  tunnelOptions: {