@tmlmobilidade/interfaces 20260709.1401.58 → 20260710.2210.9
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/dist/interfaces/agencies/agencies.d.ts +4 -0
- package/dist/interfaces/agencies/agencies.js +4 -0
- package/dist/interfaces/auth/roles.d.ts +4 -0
- package/dist/interfaces/auth/roles.js +4 -0
- package/dist/interfaces/auth/sessions.d.ts +4 -0
- package/dist/interfaces/auth/sessions.js +4 -0
- package/dist/interfaces/auth/users.d.ts +4 -0
- package/dist/interfaces/auth/users.js +4 -0
- package/dist/interfaces/auth/verification-tokens.d.ts +4 -0
- package/dist/interfaces/auth/verification-tokens.js +4 -0
- package/dist/interfaces/file-exports/file-exports.d.ts +4 -0
- package/dist/interfaces/file-exports/file-exports.js +4 -0
- package/dist/interfaces/organizations/organizations.d.ts +4 -0
- package/dist/interfaces/organizations/organizations.js +4 -0
- package/dist/interfaces/pcgidb/pcgidb-legacy.js +3 -50
- package/dist/interfaces/pcgidb/pcgidb-ticketing.js +4 -51
- package/dist/interfaces/pcgidb/pcgidb-validations.js +4 -50
- package/package.json +1 -1
|
@@ -72,5 +72,9 @@ declare class AgenciesClass extends MongoCollectionClass<Agency, CreateAgencyDto
|
|
|
72
72
|
protected getCollectionName(): string;
|
|
73
73
|
protected getEnvName(): string;
|
|
74
74
|
}
|
|
75
|
+
/**
|
|
76
|
+
* @deprecated This class is deprecated and will be removed in the future.
|
|
77
|
+
* Use `@tmlmobilidade/go-interfaces-go-db` instead.
|
|
78
|
+
*/
|
|
75
79
|
export declare const agencies: AgenciesClass;
|
|
76
80
|
export {};
|
|
@@ -39,4 +39,8 @@ class AgenciesClass extends MongoCollectionClass {
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
/* * */
|
|
42
|
+
/**
|
|
43
|
+
* @deprecated This class is deprecated and will be removed in the future.
|
|
44
|
+
* Use `@tmlmobilidade/go-interfaces-go-db` instead.
|
|
45
|
+
*/
|
|
42
46
|
export const agencies = asyncSingletonProxy(AgenciesClass);
|
|
@@ -395,5 +395,9 @@ declare class RolesClass extends MongoCollectionClass<Role, CreateRoleDto, Updat
|
|
|
395
395
|
protected getCollectionName(): string;
|
|
396
396
|
protected getEnvName(): string;
|
|
397
397
|
}
|
|
398
|
+
/**
|
|
399
|
+
* @deprecated This class is deprecated and will be removed in the future.
|
|
400
|
+
* Use `@tmlmobilidade/go-interfaces-go-db` instead.
|
|
401
|
+
*/
|
|
398
402
|
export declare const roles: RolesClass;
|
|
399
403
|
export {};
|
|
@@ -66,4 +66,8 @@ class RolesClass extends MongoCollectionClass {
|
|
|
66
66
|
return 'DATABASE_URI';
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* @deprecated This class is deprecated and will be removed in the future.
|
|
71
|
+
* Use `@tmlmobilidade/go-interfaces-go-db` instead.
|
|
72
|
+
*/
|
|
69
73
|
export const roles = asyncSingletonProxy(RolesClass);
|
|
@@ -12,5 +12,9 @@ declare class SessionsClass extends MongoCollectionClass<Session, CreateSessionD
|
|
|
12
12
|
protected getCollectionName(): string;
|
|
13
13
|
protected getEnvName(): string;
|
|
14
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated This class is deprecated and will be removed in the future.
|
|
17
|
+
* Use `@tmlmobilidade/go-interfaces-go-db` instead.
|
|
18
|
+
*/
|
|
15
19
|
export declare const sessions: SessionsClass;
|
|
16
20
|
export {};
|
|
@@ -33,4 +33,8 @@ class SessionsClass extends MongoCollectionClass {
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
/* * */
|
|
36
|
+
/**
|
|
37
|
+
* @deprecated This class is deprecated and will be removed in the future.
|
|
38
|
+
* Use `@tmlmobilidade/go-interfaces-go-db` instead.
|
|
39
|
+
*/
|
|
36
40
|
export const sessions = asyncSingletonProxy(SessionsClass);
|
|
@@ -589,5 +589,9 @@ declare class UsersClass extends MongoCollectionClass<User_UNSAFE, CreateUserDto
|
|
|
589
589
|
protected getEnvName(): string;
|
|
590
590
|
private sanitizeUser;
|
|
591
591
|
}
|
|
592
|
+
/**
|
|
593
|
+
* @deprecated This class is deprecated and will be removed in the future.
|
|
594
|
+
* Use `@tmlmobilidade/go-interfaces-go-db` instead.
|
|
595
|
+
*/
|
|
592
596
|
export declare const users: UsersClass;
|
|
593
597
|
export {};
|
|
@@ -102,4 +102,8 @@ class UsersClass extends MongoCollectionClass {
|
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
/* * */
|
|
105
|
+
/**
|
|
106
|
+
* @deprecated This class is deprecated and will be removed in the future.
|
|
107
|
+
* Use `@tmlmobilidade/go-interfaces-go-db` instead.
|
|
108
|
+
*/
|
|
105
109
|
export const users = asyncSingletonProxy(UsersClass);
|
|
@@ -33,5 +33,9 @@ declare class VerificationTokensClass extends MongoCollectionClass<VerificationT
|
|
|
33
33
|
protected getCollectionName(): string;
|
|
34
34
|
protected getEnvName(): string;
|
|
35
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* @deprecated This class is deprecated and will be removed in the future.
|
|
38
|
+
* Use `@tmlmobilidade/go-interfaces-go-db` instead.
|
|
39
|
+
*/
|
|
36
40
|
export declare const verificationTokens: VerificationTokensClass;
|
|
37
41
|
export {};
|
|
@@ -40,4 +40,8 @@ class VerificationTokensClass extends MongoCollectionClass {
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
/* * */
|
|
43
|
+
/**
|
|
44
|
+
* @deprecated This class is deprecated and will be removed in the future.
|
|
45
|
+
* Use `@tmlmobilidade/go-interfaces-go-db` instead.
|
|
46
|
+
*/
|
|
43
47
|
export const verificationTokens = asyncSingletonProxy(VerificationTokensClass);
|
|
@@ -12,5 +12,9 @@ declare class FileExportsClass extends MongoCollectionClass<FileExport, CreateFi
|
|
|
12
12
|
protected getCollectionName(): string;
|
|
13
13
|
protected getEnvName(): string;
|
|
14
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated This class is deprecated and will be removed in the future.
|
|
17
|
+
* Use `@tmlmobilidade/go-interfaces-go-db` instead.
|
|
18
|
+
*/
|
|
15
19
|
export declare const fileExports: FileExportsClass;
|
|
16
20
|
export {};
|
|
@@ -40,4 +40,8 @@ class FileExportsClass extends MongoCollectionClass {
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
/* * */
|
|
43
|
+
/**
|
|
44
|
+
* @deprecated This class is deprecated and will be removed in the future.
|
|
45
|
+
* Use `@tmlmobilidade/go-interfaces-go-db` instead.
|
|
46
|
+
*/
|
|
43
47
|
export const fileExports = asyncSingletonProxy(FileExportsClass);
|
|
@@ -12,5 +12,9 @@ declare class OrganizationsClass extends MongoCollectionClass<Organization, Crea
|
|
|
12
12
|
protected getCollectionName(): string;
|
|
13
13
|
protected getEnvName(): string;
|
|
14
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated This class is deprecated and will be removed in the future.
|
|
17
|
+
* Use `@tmlmobilidade/go-interfaces-go-db` instead.
|
|
18
|
+
*/
|
|
15
19
|
export declare const organizations: OrganizationsClass;
|
|
16
20
|
export {};
|
|
@@ -30,4 +30,8 @@ class OrganizationsClass extends MongoCollectionClass {
|
|
|
30
30
|
return 'DATABASE_URI';
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* @deprecated This class is deprecated and will be removed in the future.
|
|
35
|
+
* Use `@tmlmobilidade/go-interfaces-go-db` instead.
|
|
36
|
+
*/
|
|
33
37
|
export const organizations = asyncSingletonProxy(OrganizationsClass);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* * */
|
|
2
2
|
import { Logger } from '@tmlmobilidade/logger';
|
|
3
3
|
import { MongoConnector } from '@tmlmobilidade/mongo';
|
|
4
|
-
import {
|
|
4
|
+
import { pcgiSshTunnel } from '@tmlmobilidade/ssh';
|
|
5
5
|
/* * */
|
|
6
6
|
let GLOBAL_PCGIDB_TUNNEL_INSTANCE;
|
|
7
7
|
/* * */
|
|
@@ -57,57 +57,10 @@ class PCGIDBLegacyClass {
|
|
|
57
57
|
throw new Error('Missing PCGIDB_LEGACY_ADDRESS_1, PCGIDB_LEGACY_ADDRESS_2, PCGIDB_LEGACY_ADDRESS_3 or PCGIDB_LEGACY_PORT environment variable.');
|
|
58
58
|
}
|
|
59
59
|
//
|
|
60
|
-
// Check if the SSH Tunnel is required based on the environment.
|
|
61
|
-
// In 'production' and 'staging', we assume direct connection is used.
|
|
62
|
-
if (process.env.ENVIRONMENT === 'production' || process.env.ENVIRONMENT === 'staging') {
|
|
63
|
-
return `mongodb://${process.env.PCGIDB_LEGACY_USER}:${process.env.PCGIDB_LEGACY_PASSWORD}@${process.env.PCGIDB_LEGACY_ADDRESS_1}:${process.env.PCGIDB_LEGACY_PORT},${process.env.PCGIDB_LEGACY_ADDRESS_2}:${process.env.PCGIDB_LEGACY_PORT},${process.env.PCGIDB_LEGACY_ADDRESS_3}:${process.env.PCGIDB_LEGACY_PORT}/`;
|
|
64
|
-
}
|
|
65
|
-
//
|
|
66
|
-
// If we're here, then the SSH Tunnel is to be used.
|
|
67
|
-
// Check if the required SSH Tunnel environment variables are set.
|
|
68
|
-
if (!process.env.PCGIDB_TUNNEL_LOCAL_PORT) {
|
|
69
|
-
throw new Error('Missing PCGIDB_TUNNEL_LOCAL_PORT environment variable.');
|
|
70
|
-
}
|
|
71
|
-
if (!process.env.PCGIDB_TUNNEL_SSH_HOST || !process.env.PCGIDB_TUNNEL_SSH_USERNAME) {
|
|
72
|
-
throw new Error('Missing PCGIDB_TUNNEL_SSH_HOST or PCGIDB_TUNNEL_SSH_USERNAME environment variable.');
|
|
73
|
-
}
|
|
74
|
-
//
|
|
75
60
|
// Setup the SSH Tunnel connection configuration
|
|
76
|
-
|
|
77
|
-
forwardOptions: {
|
|
78
|
-
dstAddr: process.env.PCGIDB_LEGACY_ADDRESS_1,
|
|
79
|
-
dstPort: Number(process.env.PCGIDB_LEGACY_PORT),
|
|
80
|
-
srcAddr: 'localhost',
|
|
81
|
-
srcPort: Number(process.env.PCGIDB_TUNNEL_LOCAL_PORT),
|
|
82
|
-
},
|
|
83
|
-
serverOptions: {
|
|
84
|
-
port: Number(process.env.PCGIDB_TUNNEL_LOCAL_PORT),
|
|
85
|
-
},
|
|
86
|
-
sshOptions: {
|
|
87
|
-
/**
|
|
88
|
-
* Using SSH Agent for authentication.
|
|
89
|
-
* Ensure that your SSH key is added to the SSH agent beforehand.
|
|
90
|
-
* @see https://developer.1password.com/docs/ssh/agent/compatibility/#ssh-auth-sock
|
|
91
|
-
*/
|
|
92
|
-
agent: process.env.SSH_AUTH_SOCK,
|
|
93
|
-
host: process.env.PCGIDB_TUNNEL_SSH_HOST,
|
|
94
|
-
keepaliveCountMax: 3, // Retry 3 times before closing the connection
|
|
95
|
-
keepaliveInterval: 10_000, // Send keep-alive every 10 seconds
|
|
96
|
-
port: 22,
|
|
97
|
-
username: process.env.PCGIDB_TUNNEL_SSH_USERNAME,
|
|
98
|
-
},
|
|
99
|
-
tunnelOptions: {
|
|
100
|
-
autoClose: false,
|
|
101
|
-
reconnectOnError: true,
|
|
102
|
-
},
|
|
103
|
-
};
|
|
104
|
-
const sshOptions = {
|
|
105
|
-
maxRetries: 3,
|
|
106
|
-
};
|
|
107
|
-
//
|
|
108
|
-
// Actually create the SSH Tunnel connection
|
|
61
|
+
GLOBAL_PCGIDB_TUNNEL_INSTANCE = pcgiSshTunnel({ dstAddr: process.env.PCGIDB_LEGACY_ADDRESS_1, dstPort: Number(process.env.PCGIDB_LEGACY_PORT) });
|
|
109
62
|
if (!GLOBAL_PCGIDB_TUNNEL_INSTANCE) {
|
|
110
|
-
|
|
63
|
+
return `mongodb://${process.env.PCGIDB_LEGACY_USER}:${process.env.PCGIDB_LEGACY_PASSWORD}@${process.env.PCGIDB_LEGACY_ADDRESS_1}:${process.env.PCGIDB_LEGACY_PORT},${process.env.PCGIDB_LEGACY_ADDRESS_2}:${process.env.PCGIDB_LEGACY_PORT},${process.env.PCGIDB_LEGACY_ADDRESS_3}:${process.env.PCGIDB_LEGACY_PORT}/`;
|
|
111
64
|
}
|
|
112
65
|
Logger.info({ message: 'Setting up SSH Tunnel for PCGIDB Legacy...' });
|
|
113
66
|
const sshTunnelConnection = await GLOBAL_PCGIDB_TUNNEL_INSTANCE.connect();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* * */
|
|
2
2
|
import { Logger } from '@tmlmobilidade/logger';
|
|
3
3
|
import { MongoConnector } from '@tmlmobilidade/mongo';
|
|
4
|
-
import {
|
|
4
|
+
import { pcgiSshTunnel } from '@tmlmobilidade/ssh';
|
|
5
5
|
/* * */
|
|
6
6
|
let GLOBAL_PCGIDB_TUNNEL_INSTANCE;
|
|
7
7
|
/* * */
|
|
@@ -56,57 +56,10 @@ class PCGIDBTicketingClass {
|
|
|
56
56
|
throw new Error('Missing PCGIDB_TICKETING_ADDRESS_1, PCGIDB_TICKETING_ADDRESS_2, PCGIDB_TICKETING_ADDRESS_3 or PCGIDB_TICKETING_PORT environment variable.');
|
|
57
57
|
}
|
|
58
58
|
//
|
|
59
|
-
//
|
|
60
|
-
|
|
61
|
-
if (process.env.ENVIRONMENT === 'production' || process.env.ENVIRONMENT === 'staging') {
|
|
62
|
-
return `mongodb://${process.env.PCGIDB_TICKETING_USER}:${process.env.PCGIDB_TICKETING_PASSWORD}@${process.env.PCGIDB_TICKETING_ADDRESS_1}:${process.env.PCGIDB_TICKETING_PORT},${process.env.PCGIDB_TICKETING_ADDRESS_2}:${process.env.PCGIDB_TICKETING_PORT},${process.env.PCGIDB_TICKETING_ADDRESS_3}:${process.env.PCGIDB_TICKETING_PORT}/`;
|
|
63
|
-
}
|
|
64
|
-
//
|
|
65
|
-
// If we're here, then the SSH Tunnel is to be used.
|
|
66
|
-
// Check if the required SSH Tunnel environment variables are set.
|
|
67
|
-
if (!process.env.PCGIDB_TUNNEL_LOCAL_PORT) {
|
|
68
|
-
throw new Error('Missing PCGIDB_TUNNEL_LOCAL_PORT environment variable.');
|
|
69
|
-
}
|
|
70
|
-
if (!process.env.PCGIDB_TUNNEL_SSH_HOST || !process.env.PCGIDB_TUNNEL_SSH_USERNAME) {
|
|
71
|
-
throw new Error('Missing PCGIDB_TUNNEL_SSH_HOST or PCGIDB_TUNNEL_SSH_USERNAME environment variable.');
|
|
72
|
-
}
|
|
73
|
-
//
|
|
74
|
-
// Setup the SSH Tunnel connection configuration
|
|
75
|
-
const sshConfig = {
|
|
76
|
-
forwardOptions: {
|
|
77
|
-
dstAddr: process.env.PCGIDB_TICKETING_ADDRESS_1,
|
|
78
|
-
dstPort: Number(process.env.PCGIDB_TICKETING_PORT),
|
|
79
|
-
srcAddr: 'localhost',
|
|
80
|
-
srcPort: Number(process.env.PCGIDB_TUNNEL_LOCAL_PORT),
|
|
81
|
-
},
|
|
82
|
-
serverOptions: {
|
|
83
|
-
port: Number(process.env.PCGIDB_TUNNEL_LOCAL_PORT),
|
|
84
|
-
},
|
|
85
|
-
sshOptions: {
|
|
86
|
-
/**
|
|
87
|
-
* Using SSH Agent for authentication.
|
|
88
|
-
* Ensure that your SSH key is added to the SSH agent beforehand.
|
|
89
|
-
* @see https://developer.1password.com/docs/ssh/agent/compatibility/#ssh-auth-sock
|
|
90
|
-
*/
|
|
91
|
-
agent: process.env.SSH_AUTH_SOCK,
|
|
92
|
-
host: process.env.PCGIDB_TUNNEL_SSH_HOST,
|
|
93
|
-
keepaliveCountMax: 3, // Retry 3 times before closing the connection
|
|
94
|
-
keepaliveInterval: 10_000, // Send keep-alive every 10 seconds
|
|
95
|
-
port: 22,
|
|
96
|
-
username: process.env.PCGIDB_TUNNEL_SSH_USERNAME,
|
|
97
|
-
},
|
|
98
|
-
tunnelOptions: {
|
|
99
|
-
autoClose: false,
|
|
100
|
-
reconnectOnError: true,
|
|
101
|
-
},
|
|
102
|
-
};
|
|
103
|
-
const sshOptions = {
|
|
104
|
-
maxRetries: 3,
|
|
105
|
-
};
|
|
106
|
-
//
|
|
107
|
-
// Actually create the SSH Tunnel connection
|
|
59
|
+
// Setup the SSH Tunnel
|
|
60
|
+
GLOBAL_PCGIDB_TUNNEL_INSTANCE = pcgiSshTunnel({ dstAddr: process.env.PCGIDB_TICKETING_ADDRESS_1, dstPort: Number(process.env.PCGIDB_TICKETING_PORT) });
|
|
108
61
|
if (!GLOBAL_PCGIDB_TUNNEL_INSTANCE) {
|
|
109
|
-
|
|
62
|
+
return `mongodb://${process.env.PCGIDB_TICKETING_USER}:${process.env.PCGIDB_TICKETING_PASSWORD}@${process.env.PCGIDB_TICKETING_ADDRESS_1}:${process.env.PCGIDB_TICKETING_PORT},${process.env.PCGIDB_TICKETING_ADDRESS_2}:${process.env.PCGIDB_TICKETING_PORT},${process.env.PCGIDB_TICKETING_ADDRESS_3}:${process.env.PCGIDB_TICKETING_PORT}/`;
|
|
110
63
|
}
|
|
111
64
|
Logger.info({ message: 'Setting up SSH Tunnel for PCGIDB Ticketing...' });
|
|
112
65
|
const sshTunnelConnection = await GLOBAL_PCGIDB_TUNNEL_INSTANCE.connect();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* * */
|
|
2
2
|
import { Logger } from '@tmlmobilidade/logger';
|
|
3
3
|
import { MongoConnector } from '@tmlmobilidade/mongo';
|
|
4
|
-
import {
|
|
4
|
+
import { pcgiSshTunnel } from '@tmlmobilidade/ssh';
|
|
5
5
|
/* * */
|
|
6
6
|
let GLOBAL_PCGIDB_TUNNEL_INSTANCE;
|
|
7
7
|
/* * */
|
|
@@ -58,58 +58,12 @@ class PCGIDBValidationsClass {
|
|
|
58
58
|
throw new Error('Missing PCGIDB_VALIDATIONS_ADDRESS_1, PCGIDB_VALIDATIONS_ADDRESS_2, PCGIDB_VALIDATIONS_ADDRESS_3 or PCGIDB_VALIDATIONS_PORT environment variable.');
|
|
59
59
|
}
|
|
60
60
|
//
|
|
61
|
-
//
|
|
62
|
-
|
|
63
|
-
if (
|
|
61
|
+
// Setup the SSH Tunnel
|
|
62
|
+
GLOBAL_PCGIDB_TUNNEL_INSTANCE = pcgiSshTunnel({ dstAddr: process.env.PCGIDB_VALIDATIONS_ADDRESS_1, dstPort: Number(process.env.PCGIDB_VALIDATIONS_PORT) });
|
|
63
|
+
if (!GLOBAL_PCGIDB_TUNNEL_INSTANCE) {
|
|
64
64
|
return `mongodb://${process.env.PCGIDB_VALIDATIONS_USER}:${process.env.PCGIDB_VALIDATIONS_PASSWORD}@${process.env.PCGIDB_VALIDATIONS_ADDRESS_1}:${process.env.PCGIDB_VALIDATIONS_PORT},${process.env.PCGIDB_VALIDATIONS_ADDRESS_2}:${process.env.PCGIDB_VALIDATIONS_PORT},${process.env.PCGIDB_VALIDATIONS_ADDRESS_3}:${process.env.PCGIDB_VALIDATIONS_PORT}/`;
|
|
65
65
|
}
|
|
66
66
|
//
|
|
67
|
-
// If we're here, then the SSH Tunnel is to be used.
|
|
68
|
-
// Check if the required SSH Tunnel environment variables are set.
|
|
69
|
-
if (!process.env.PCGIDB_TUNNEL_LOCAL_PORT) {
|
|
70
|
-
throw new Error('Missing PCGIDB_TUNNEL_LOCAL_PORT environment variable.');
|
|
71
|
-
}
|
|
72
|
-
if (!process.env.PCGIDB_TUNNEL_SSH_HOST || !process.env.PCGIDB_TUNNEL_SSH_USERNAME) {
|
|
73
|
-
throw new Error('Missing PCGIDB_TUNNEL_SSH_HOST or PCGIDB_TUNNEL_SSH_USERNAME environment variable.');
|
|
74
|
-
}
|
|
75
|
-
//
|
|
76
|
-
// Setup the SSH Tunnel connection configuration
|
|
77
|
-
const sshConfig = {
|
|
78
|
-
forwardOptions: {
|
|
79
|
-
dstAddr: process.env.PCGIDB_VALIDATIONS_ADDRESS_1,
|
|
80
|
-
dstPort: Number(process.env.PCGIDB_VALIDATIONS_PORT),
|
|
81
|
-
srcAddr: 'localhost',
|
|
82
|
-
srcPort: Number(process.env.PCGIDB_TUNNEL_LOCAL_PORT),
|
|
83
|
-
},
|
|
84
|
-
serverOptions: {
|
|
85
|
-
port: Number(process.env.PCGIDB_TUNNEL_LOCAL_PORT),
|
|
86
|
-
},
|
|
87
|
-
sshOptions: {
|
|
88
|
-
/**
|
|
89
|
-
* Using SSH Agent for authentication.
|
|
90
|
-
* Ensure that your SSH key is added to the SSH agent beforehand.
|
|
91
|
-
* @see https://developer.1password.com/docs/ssh/agent/compatibility/#ssh-auth-sock
|
|
92
|
-
*/
|
|
93
|
-
agent: process.env.SSH_AUTH_SOCK,
|
|
94
|
-
host: process.env.PCGIDB_TUNNEL_SSH_HOST,
|
|
95
|
-
keepaliveCountMax: 3, // Retry 3 times before closing the connection
|
|
96
|
-
keepaliveInterval: 10_000, // Send keep-alive every 10 seconds
|
|
97
|
-
port: 22,
|
|
98
|
-
username: process.env.PCGIDB_TUNNEL_SSH_USERNAME,
|
|
99
|
-
},
|
|
100
|
-
tunnelOptions: {
|
|
101
|
-
autoClose: false,
|
|
102
|
-
reconnectOnError: true,
|
|
103
|
-
},
|
|
104
|
-
};
|
|
105
|
-
const sshOptions = {
|
|
106
|
-
maxRetries: 3,
|
|
107
|
-
};
|
|
108
|
-
//
|
|
109
|
-
// Actually create the SSH Tunnel connection
|
|
110
|
-
if (!GLOBAL_PCGIDB_TUNNEL_INSTANCE) {
|
|
111
|
-
GLOBAL_PCGIDB_TUNNEL_INSTANCE = new SshTunnelService(sshConfig, sshOptions);
|
|
112
|
-
}
|
|
113
67
|
Logger.info({ message: 'Setting up SSH Tunnel for PCGIDB Validations...' });
|
|
114
68
|
const sshTunnelConnection = await GLOBAL_PCGIDB_TUNNEL_INSTANCE.connect();
|
|
115
69
|
//
|