-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathenvConfig.mjs
More file actions
103 lines (93 loc) · 3.25 KB
/
Copy pathenvConfig.mjs
File metadata and controls
103 lines (93 loc) · 3.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
import { fileURLToPath } from 'node:url';
import path from 'node:path';
import { config } from 'dotenv';
config({ path: new URL('../.env', import.meta.url) });
if (!process.env.HDB_ADMIN_USERNAME || !process.env.HDB_ADMIN_PASSWORD) {
console.error('❌ Environment variables HDB_ADMIN_USERNAME and HDB_ADMIN_PASSWORD must be set.');
process.exit(1);
}
export let testData = {
'host': 'http://localhost',
'port': '9925',
'portRest': '9926',
'secureHost': 'https://localhost',
'securePort': '9943',
'securePortRest': '9953',
'username': process.env.HDB_ADMIN_USERNAME,
'password': process.env.HDB_ADMIN_PASSWORD,
'schema': 'northnwd',
'schema_dev': 'dev',
'schema_call': 'call',
'schema_other': 'other',
'schema_another': 'another',
'schema_number_string': '123',
'schema_number': '1123',
'emps_tb': 'employees',
'emps_id': 'employeeid',
'ords_tb': 'orders',
'ords_id': 'orderid',
'ordd_tb': 'order_details',
'ordd_id': 'orderid',
'prod_tb': 'products',
'prod_id': 'productid',
'cust_tb': 'customers',
'cust_id': 'customerid',
'cate_tb': 'categories',
'cate_id': 'categoryid',
'supp_tb': 'suppliers',
'supp_id': 'supplierid',
'ship_tb': 'shippers',
'ship_id': 'shipperid',
'empt_tb': 'employeeterritories',
'empt_id': 'employeeid',
'terr_tb': 'territories',
'terr_id': 'territoryid',
'regi_tb': 'region',
'regi_id': 'regionid',
'user_id': '',
'test_user_name': 'test_user',
'job_id': '',
'next_request': '',
'function:getJobId': '',
'insert_timestamp': '0',
'csv_tb': 'url_csv_data',
'csv_tb_empty': 'url_csv_no_data',
'drop_schema': 'drop_schema',
'drop_table': 'drop_table',
'operation_token': '',
'refresh_token': '',
'my_operation_token': '',
'rootPath': '',
'restartTimeout': 45000,
'restartHttpWorkersTimeout': 15000,
'jobErrorMessage': '',
'blobsPath': '/blobs/blob/0/0/',
};
export const envUrl = `${testData.host}:${testData.port}`;
export const envUrlRest = `${testData.host}:${testData.portRest}`;
export const envUrlSecure = `${testData.secureHost}:${testData.securePort}`;
export const envUrlSecureRest = `${testData.secureHost}:${testData.securePortRest}`;
export const headers = createHeaders(testData.username, testData.password);
export const headersBulkLoadUser = createHeaders('bulk_load_user', testData.password);
export const headersTestUser = createHeaders(testData.test_user_name, testData.password);
export const headersNoPermsUser = createHeaders('no_perms_user', testData.password);
export const headersOnePermUser = createHeaders('one_perm_user', testData.password);
export const headersImportantUser = createHeaders('important-user', 'password');
export function createHeaders(username, password) {
const headers = {
'Authorization': `Basic ${Buffer.from(`${username}:${password}`).toString('base64')}`,
'Content-Type': 'application/json',
'Connection': 'close',
};
return headers;
}
export const dateYesterday = new Date(new Date().getTime() - 86400000).toISOString();
export const dateTomorrow = new Date(new Date().getTime() + 86400000).toISOString();
export function getCsvPath() {
if (process.env.FILES_LOCATION) {
return process.env.FILES_LOCATION;
}
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
return path.resolve(path.join(__dirname, '../data/')) + '/';
}