@dataformer/env-service 3.0.1 → 3.0.4
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/CHANGELOG.md +6 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.js +27 -1
- package/package.json +10 -7
- package/src/index.ts +24 -0
package/CHANGELOG.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -26,8 +26,10 @@ declare const setConfluenceUserEmail: () => Promise<void>;
|
|
|
26
26
|
declare const setConfluenceDefaultSpaceId: () => Promise<void>;
|
|
27
27
|
declare const setGeminiApiKey: () => Promise<void>;
|
|
28
28
|
declare const setNpmToken: () => Promise<void>;
|
|
29
|
+
declare const setPulumiAccessToken: () => Promise<void>;
|
|
29
30
|
declare const setCustomSearchApiKey: () => Promise<void>;
|
|
30
31
|
declare const setCustomSearchEngineId: () => Promise<void>;
|
|
32
|
+
declare const setGithubToken: () => Promise<void>;
|
|
31
33
|
declare const setFirestoreProjectId: () => Promise<void>;
|
|
32
34
|
declare const getLogToConsole: () => Promise<string | null>;
|
|
33
35
|
declare const getPostgresUser: () => Promise<string | null>;
|
|
@@ -51,8 +53,10 @@ declare const getConfluenceUserEmail: () => Promise<string | null>;
|
|
|
51
53
|
declare const getConfluenceDefaultSpaceId: () => Promise<string | null>;
|
|
52
54
|
declare const getGeminiApiKey: () => Promise<string | null>;
|
|
53
55
|
declare const getNpmToken: () => Promise<string | null>;
|
|
56
|
+
declare const getPulumiAccessToken: () => Promise<string | null>;
|
|
57
|
+
declare const getGithubToken: () => Promise<string | null>;
|
|
54
58
|
declare const getProjectRoot: () => string;
|
|
55
59
|
declare const printEnv: () => Promise<void>;
|
|
56
60
|
declare const run: () => Promise<void>;
|
|
57
61
|
|
|
58
|
-
export { askQuestion, getBigtableInstanceName, getBigtableProjectId, getBigtableTableName, getConfluenceApiBaseUrl, getConfluenceApiToken, getConfluenceDefaultSpaceId, getConfluenceUserEmail, getCustomSearchApiKey, getCustomSearchEngineId, getEnvVar, getFirestoreProjectId, getGcpProjectId, getGeminiApiKey, getJiraApiBaseUrl, getJiraApiToken, getJiraUserEmail, getLogToConsole, getNpmToken, getPostgresAuthType, getPostgresDatabase, getPostgresHostName, getPostgresInstanceConnectionName, getPostgresIpType, getPostgresPassword, getPostgresPoolSizeMax, getPostgresUser, getProjectRoot, obfuscateCred, printEnv, run, setBigtableInstanceName, setBigtableProjectId, setBigtableTableName, setConfluenceApiBaseUrl, setConfluenceApiToken, setConfluenceDefaultSpaceId, setConfluenceUserEmail, setCustomSearchApiKey, setCustomSearchEngineId, setEnvVar, setFirestoreProjectId, setGeminiApiKey, setJiraApiBaseUrl, setJiraApiToken, setJiraUserEmail, setLogToConsole, setNpmToken, setPostgresAuthType, setPostgresDatabase, setPostgresHostName, setPostgresInstanceConnectionName, setPostgresIpType, setPostgresPassword, setPostgresPoolSizeMax, setPostgresUser };
|
|
62
|
+
export { askQuestion, getBigtableInstanceName, getBigtableProjectId, getBigtableTableName, getConfluenceApiBaseUrl, getConfluenceApiToken, getConfluenceDefaultSpaceId, getConfluenceUserEmail, getCustomSearchApiKey, getCustomSearchEngineId, getEnvVar, getFirestoreProjectId, getGcpProjectId, getGeminiApiKey, getGithubToken, getJiraApiBaseUrl, getJiraApiToken, getJiraUserEmail, getLogToConsole, getNpmToken, getPostgresAuthType, getPostgresDatabase, getPostgresHostName, getPostgresInstanceConnectionName, getPostgresIpType, getPostgresPassword, getPostgresPoolSizeMax, getPostgresUser, getProjectRoot, getPulumiAccessToken, obfuscateCred, printEnv, run, setBigtableInstanceName, setBigtableProjectId, setBigtableTableName, setConfluenceApiBaseUrl, setConfluenceApiToken, setConfluenceDefaultSpaceId, setConfluenceUserEmail, setCustomSearchApiKey, setCustomSearchEngineId, setEnvVar, setFirestoreProjectId, setGeminiApiKey, setGithubToken, setJiraApiBaseUrl, setJiraApiToken, setJiraUserEmail, setLogToConsole, setNpmToken, setPostgresAuthType, setPostgresDatabase, setPostgresHostName, setPostgresInstanceConnectionName, setPostgresIpType, setPostgresPassword, setPostgresPoolSizeMax, setPostgresUser, setPulumiAccessToken };
|
package/dist/index.js
CHANGED
|
@@ -303,6 +303,10 @@ var setNpmToken = async () => {
|
|
|
303
303
|
const npmToken = await askQuestion("Enter NPM Token:");
|
|
304
304
|
if (npmToken) await setEnvVar("NPM_TOKEN", npmToken);
|
|
305
305
|
};
|
|
306
|
+
var setPulumiAccessToken = async () => {
|
|
307
|
+
const pulumiToken = await askQuestion("Enter Pulumi Access Token (from https://app.pulumi.com/account/tokens):");
|
|
308
|
+
if (pulumiToken) await setEnvVar("PULUMI_ACCESS_TOKEN", pulumiToken);
|
|
309
|
+
};
|
|
306
310
|
var setCustomSearchApiKey = async () => {
|
|
307
311
|
const customSearchApiKey = await askQuestion("Enter Custom Search API Key", "");
|
|
308
312
|
if (customSearchApiKey) {
|
|
@@ -315,6 +319,12 @@ var setCustomSearchEngineId = async () => {
|
|
|
315
319
|
await setEnvVar("CUSTOM_SEARCH_ENGINE_ID", customSearchEngineId);
|
|
316
320
|
}
|
|
317
321
|
};
|
|
322
|
+
var setGithubToken = async () => {
|
|
323
|
+
const githubToken = await askQuestion("Enter GitHub Token (Personal Access Token)", "");
|
|
324
|
+
if (githubToken) {
|
|
325
|
+
await setEnvVar("GITHUB_TOKEN", githubToken);
|
|
326
|
+
}
|
|
327
|
+
};
|
|
318
328
|
var setFirestoreProjectId = async () => {
|
|
319
329
|
const firestoreProjectId = await askQuestion("Enter Firestore Project ID", "dataformer-prod");
|
|
320
330
|
if (firestoreProjectId) {
|
|
@@ -347,6 +357,8 @@ var getConfluenceUserEmail = async () => await getEnvVar("CONFLUENCE_USER_EMAIL"
|
|
|
347
357
|
var getConfluenceDefaultSpaceId = async () => await getEnvVar("CONFLUENCE_DEFAULT_SPACE_ID");
|
|
348
358
|
var getGeminiApiKey = async () => await getEnvVar("GEMINI_API_KEY");
|
|
349
359
|
var getNpmToken = async () => await getEnvVar("NPM_TOKEN");
|
|
360
|
+
var getPulumiAccessToken = async () => await getEnvVar("PULUMI_ACCESS_TOKEN");
|
|
361
|
+
var getGithubToken = async () => await getEnvVar("GITHUB_TOKEN");
|
|
350
362
|
var getProjectRoot = () => {
|
|
351
363
|
const currentDir = path.dirname(new URL(import.meta.url).pathname);
|
|
352
364
|
return path.resolve(currentDir, "../..");
|
|
@@ -377,6 +389,8 @@ var printEnv = async () => {
|
|
|
377
389
|
const customSearchEngineId = await getCustomSearchEngineId();
|
|
378
390
|
const gcpProjectIdVal = await getGcpProjectId();
|
|
379
391
|
const npmToken = await getNpmToken();
|
|
392
|
+
const pulumiAccessToken = await getPulumiAccessToken();
|
|
393
|
+
const githubToken = await getGithubToken();
|
|
380
394
|
console.log(`Project Root: ${getProjectRoot()}`);
|
|
381
395
|
console.log(`GCP Project ID: ${gcpProjectIdVal}`);
|
|
382
396
|
console.log(`Log to Console: ${logToConsole}`);
|
|
@@ -403,6 +417,8 @@ var printEnv = async () => {
|
|
|
403
417
|
console.log(`Custom Search Engine ID: ${customSearchEngineId}`);
|
|
404
418
|
console.log(`Gemini API Key: ${obfuscateCred(geminiApiKey)}`);
|
|
405
419
|
console.log(`NPM Token: ${obfuscateCred(npmToken)}`);
|
|
420
|
+
console.log(`Pulumi Access Token: ${obfuscateCred(pulumiAccessToken)}`);
|
|
421
|
+
console.log(`GitHub Token: ${obfuscateCred(githubToken)}`);
|
|
406
422
|
};
|
|
407
423
|
var run = async () => {
|
|
408
424
|
const command = process.argv[2];
|
|
@@ -473,12 +489,18 @@ var run = async () => {
|
|
|
473
489
|
case "setNpmToken":
|
|
474
490
|
await setNpmToken();
|
|
475
491
|
break;
|
|
492
|
+
case "setPulumiAccessToken":
|
|
493
|
+
await setPulumiAccessToken();
|
|
494
|
+
break;
|
|
476
495
|
case "setCustomSearchApiKey":
|
|
477
496
|
await setCustomSearchApiKey();
|
|
478
497
|
break;
|
|
479
498
|
case "setCustomSearchEngineId":
|
|
480
499
|
await setCustomSearchEngineId();
|
|
481
500
|
break;
|
|
501
|
+
case "setGithubToken":
|
|
502
|
+
await setGithubToken();
|
|
503
|
+
break;
|
|
482
504
|
case "printEnv":
|
|
483
505
|
await printEnv();
|
|
484
506
|
break;
|
|
@@ -509,6 +531,7 @@ export {
|
|
|
509
531
|
getFirestoreProjectId,
|
|
510
532
|
getGcpProjectId,
|
|
511
533
|
getGeminiApiKey,
|
|
534
|
+
getGithubToken,
|
|
512
535
|
getJiraApiBaseUrl,
|
|
513
536
|
getJiraApiToken,
|
|
514
537
|
getJiraUserEmail,
|
|
@@ -523,6 +546,7 @@ export {
|
|
|
523
546
|
getPostgresPoolSizeMax,
|
|
524
547
|
getPostgresUser,
|
|
525
548
|
getProjectRoot,
|
|
549
|
+
getPulumiAccessToken,
|
|
526
550
|
obfuscateCred,
|
|
527
551
|
printEnv,
|
|
528
552
|
run,
|
|
@@ -538,6 +562,7 @@ export {
|
|
|
538
562
|
setEnvVar,
|
|
539
563
|
setFirestoreProjectId,
|
|
540
564
|
setGeminiApiKey,
|
|
565
|
+
setGithubToken,
|
|
541
566
|
setJiraApiBaseUrl,
|
|
542
567
|
setJiraApiToken,
|
|
543
568
|
setJiraUserEmail,
|
|
@@ -550,5 +575,6 @@ export {
|
|
|
550
575
|
setPostgresIpType,
|
|
551
576
|
setPostgresPassword,
|
|
552
577
|
setPostgresPoolSizeMax,
|
|
553
|
-
setPostgresUser
|
|
578
|
+
setPostgresUser,
|
|
579
|
+
setPulumiAccessToken
|
|
554
580
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dataformer/env-service",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.4",
|
|
4
|
+
"publishConfig": {
|
|
5
|
+
"access": "restricted"
|
|
6
|
+
},
|
|
4
7
|
"description": "Environment service for Dataformer",
|
|
5
8
|
"type": "module",
|
|
6
9
|
"main": "dist/index.js",
|
|
@@ -11,11 +14,6 @@
|
|
|
11
14
|
"types": "./dist/index.d.ts"
|
|
12
15
|
}
|
|
13
16
|
},
|
|
14
|
-
"scripts": {
|
|
15
|
-
"build": "tsup src/index.ts --format esm --dts --clean",
|
|
16
|
-
"dev": "tsup src/index.ts --format esm --dts --watch",
|
|
17
|
-
"prepublish": "pnpm run build"
|
|
18
|
-
},
|
|
19
17
|
"dependencies": {
|
|
20
18
|
"@google-cloud/secret-manager": "^5.4.0"
|
|
21
19
|
},
|
|
@@ -25,5 +23,10 @@
|
|
|
25
23
|
},
|
|
26
24
|
"peerDependencies": {
|
|
27
25
|
"typescript": "^5.0.0"
|
|
26
|
+
},
|
|
27
|
+
"scripts": {
|
|
28
|
+
"build": "tsup src/index.ts --format esm --dts --clean",
|
|
29
|
+
"dev": "tsup src/index.ts --format esm --dts --watch",
|
|
30
|
+
"prepublish": "pnpm run build"
|
|
28
31
|
}
|
|
29
|
-
}
|
|
32
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -412,6 +412,11 @@ const setNpmToken = async (): Promise<void> => {
|
|
|
412
412
|
if (npmToken) await setEnvVar('NPM_TOKEN', npmToken);
|
|
413
413
|
};
|
|
414
414
|
|
|
415
|
+
const setPulumiAccessToken = async (): Promise<void> => {
|
|
416
|
+
const pulumiToken = await askQuestion('Enter Pulumi Access Token (from https://app.pulumi.com/account/tokens):');
|
|
417
|
+
if (pulumiToken) await setEnvVar('PULUMI_ACCESS_TOKEN', pulumiToken);
|
|
418
|
+
};
|
|
419
|
+
|
|
415
420
|
const setCustomSearchApiKey = async (): Promise<void> => {
|
|
416
421
|
const customSearchApiKey = await askQuestion('Enter Custom Search API Key', '');
|
|
417
422
|
if (customSearchApiKey) {
|
|
@@ -426,6 +431,13 @@ const setCustomSearchEngineId = async (): Promise<void> => {
|
|
|
426
431
|
}
|
|
427
432
|
};
|
|
428
433
|
|
|
434
|
+
const setGithubToken = async (): Promise<void> => {
|
|
435
|
+
const githubToken = await askQuestion('Enter GitHub Token (Personal Access Token)', '');
|
|
436
|
+
if (githubToken) {
|
|
437
|
+
await setEnvVar('GITHUB_TOKEN', githubToken);
|
|
438
|
+
}
|
|
439
|
+
};
|
|
440
|
+
|
|
429
441
|
const setFirestoreProjectId = async (): Promise<void> => {
|
|
430
442
|
const firestoreProjectId = await askQuestion('Enter Firestore Project ID', 'dataformer-prod');
|
|
431
443
|
if (firestoreProjectId) {
|
|
@@ -462,6 +474,8 @@ const getConfluenceUserEmail = async (): Promise<string | null> => await getEnvV
|
|
|
462
474
|
const getConfluenceDefaultSpaceId = async (): Promise<string | null> => await getEnvVar('CONFLUENCE_DEFAULT_SPACE_ID');
|
|
463
475
|
const getGeminiApiKey = async (): Promise<string | null> => await getEnvVar('GEMINI_API_KEY');
|
|
464
476
|
const getNpmToken = async (): Promise<string | null> => await getEnvVar('NPM_TOKEN');
|
|
477
|
+
const getPulumiAccessToken = async (): Promise<string | null> => await getEnvVar('PULUMI_ACCESS_TOKEN');
|
|
478
|
+
const getGithubToken = async (): Promise<string | null> => await getEnvVar('GITHUB_TOKEN');
|
|
465
479
|
|
|
466
480
|
const getProjectRoot = (): string => {
|
|
467
481
|
// When compiled, this will be in dist/services/, so we need to go up two levels
|
|
@@ -505,6 +519,8 @@ const printEnv = async (): Promise<void> => {
|
|
|
505
519
|
const customSearchEngineId = await getCustomSearchEngineId();
|
|
506
520
|
const gcpProjectIdVal = await getGcpProjectId();
|
|
507
521
|
const npmToken = await getNpmToken();
|
|
522
|
+
const pulumiAccessToken = await getPulumiAccessToken();
|
|
523
|
+
const githubToken = await getGithubToken();
|
|
508
524
|
|
|
509
525
|
console.log(`Project Root: ${getProjectRoot()}`);
|
|
510
526
|
console.log(`GCP Project ID: ${gcpProjectIdVal}`);
|
|
@@ -532,6 +548,8 @@ const printEnv = async (): Promise<void> => {
|
|
|
532
548
|
console.log(`Custom Search Engine ID: ${customSearchEngineId}`);
|
|
533
549
|
console.log(`Gemini API Key: ${obfuscateCred(geminiApiKey)}`);
|
|
534
550
|
console.log(`NPM Token: ${obfuscateCred(npmToken)}`);
|
|
551
|
+
console.log(`Pulumi Access Token: ${obfuscateCred(pulumiAccessToken)}`);
|
|
552
|
+
console.log(`GitHub Token: ${obfuscateCred(githubToken)}`);
|
|
535
553
|
};
|
|
536
554
|
|
|
537
555
|
const run = async (): Promise<void> => {
|
|
@@ -559,8 +577,10 @@ const run = async (): Promise<void> => {
|
|
|
559
577
|
case 'setConfluenceDefaultSpaceId': await setConfluenceDefaultSpaceId(); break;
|
|
560
578
|
case 'setGeminiApiKey': await setGeminiApiKey(); break;
|
|
561
579
|
case 'setNpmToken': await setNpmToken(); break;
|
|
580
|
+
case 'setPulumiAccessToken': await setPulumiAccessToken(); break;
|
|
562
581
|
case 'setCustomSearchApiKey': await setCustomSearchApiKey(); break;
|
|
563
582
|
case 'setCustomSearchEngineId': await setCustomSearchEngineId(); break;
|
|
583
|
+
case 'setGithubToken': await setGithubToken(); break;
|
|
564
584
|
case 'printEnv': await printEnv(); break;
|
|
565
585
|
default: console.log('Unknown command. Available commands: setEnv, setBearerToken, ..., printEnv');
|
|
566
586
|
}
|
|
@@ -605,8 +625,10 @@ export {
|
|
|
605
625
|
setConfluenceDefaultSpaceId,
|
|
606
626
|
setGeminiApiKey,
|
|
607
627
|
setNpmToken,
|
|
628
|
+
setPulumiAccessToken,
|
|
608
629
|
setCustomSearchApiKey,
|
|
609
630
|
setCustomSearchEngineId,
|
|
631
|
+
setGithubToken,
|
|
610
632
|
|
|
611
633
|
// Getters
|
|
612
634
|
getLogToConsole,
|
|
@@ -630,6 +652,8 @@ export {
|
|
|
630
652
|
getConfluenceDefaultSpaceId,
|
|
631
653
|
getGeminiApiKey,
|
|
632
654
|
getNpmToken,
|
|
655
|
+
getPulumiAccessToken,
|
|
656
|
+
getGithubToken,
|
|
633
657
|
|
|
634
658
|
// Synchronous Getters / Utility
|
|
635
659
|
getProjectRoot,
|