@dataformer/env-service 3.0.2 → 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 +3 -1
- package/dist/index.js +14 -0
- package/package.json +10 -7
- package/src/index.ts +13 -0
package/CHANGELOG.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -29,6 +29,7 @@ declare const setNpmToken: () => Promise<void>;
|
|
|
29
29
|
declare const setPulumiAccessToken: () => Promise<void>;
|
|
30
30
|
declare const setCustomSearchApiKey: () => Promise<void>;
|
|
31
31
|
declare const setCustomSearchEngineId: () => Promise<void>;
|
|
32
|
+
declare const setGithubToken: () => Promise<void>;
|
|
32
33
|
declare const setFirestoreProjectId: () => Promise<void>;
|
|
33
34
|
declare const getLogToConsole: () => Promise<string | null>;
|
|
34
35
|
declare const getPostgresUser: () => Promise<string | null>;
|
|
@@ -53,8 +54,9 @@ declare const getConfluenceDefaultSpaceId: () => Promise<string | null>;
|
|
|
53
54
|
declare const getGeminiApiKey: () => Promise<string | null>;
|
|
54
55
|
declare const getNpmToken: () => Promise<string | null>;
|
|
55
56
|
declare const getPulumiAccessToken: () => Promise<string | null>;
|
|
57
|
+
declare const getGithubToken: () => Promise<string | null>;
|
|
56
58
|
declare const getProjectRoot: () => string;
|
|
57
59
|
declare const printEnv: () => Promise<void>;
|
|
58
60
|
declare const run: () => Promise<void>;
|
|
59
61
|
|
|
60
|
-
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, getPulumiAccessToken, 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, setPulumiAccessToken };
|
|
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
|
@@ -319,6 +319,12 @@ var setCustomSearchEngineId = async () => {
|
|
|
319
319
|
await setEnvVar("CUSTOM_SEARCH_ENGINE_ID", customSearchEngineId);
|
|
320
320
|
}
|
|
321
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
|
+
};
|
|
322
328
|
var setFirestoreProjectId = async () => {
|
|
323
329
|
const firestoreProjectId = await askQuestion("Enter Firestore Project ID", "dataformer-prod");
|
|
324
330
|
if (firestoreProjectId) {
|
|
@@ -352,6 +358,7 @@ var getConfluenceDefaultSpaceId = async () => await getEnvVar("CONFLUENCE_DEFAUL
|
|
|
352
358
|
var getGeminiApiKey = async () => await getEnvVar("GEMINI_API_KEY");
|
|
353
359
|
var getNpmToken = async () => await getEnvVar("NPM_TOKEN");
|
|
354
360
|
var getPulumiAccessToken = async () => await getEnvVar("PULUMI_ACCESS_TOKEN");
|
|
361
|
+
var getGithubToken = async () => await getEnvVar("GITHUB_TOKEN");
|
|
355
362
|
var getProjectRoot = () => {
|
|
356
363
|
const currentDir = path.dirname(new URL(import.meta.url).pathname);
|
|
357
364
|
return path.resolve(currentDir, "../..");
|
|
@@ -383,6 +390,7 @@ var printEnv = async () => {
|
|
|
383
390
|
const gcpProjectIdVal = await getGcpProjectId();
|
|
384
391
|
const npmToken = await getNpmToken();
|
|
385
392
|
const pulumiAccessToken = await getPulumiAccessToken();
|
|
393
|
+
const githubToken = await getGithubToken();
|
|
386
394
|
console.log(`Project Root: ${getProjectRoot()}`);
|
|
387
395
|
console.log(`GCP Project ID: ${gcpProjectIdVal}`);
|
|
388
396
|
console.log(`Log to Console: ${logToConsole}`);
|
|
@@ -410,6 +418,7 @@ var printEnv = async () => {
|
|
|
410
418
|
console.log(`Gemini API Key: ${obfuscateCred(geminiApiKey)}`);
|
|
411
419
|
console.log(`NPM Token: ${obfuscateCred(npmToken)}`);
|
|
412
420
|
console.log(`Pulumi Access Token: ${obfuscateCred(pulumiAccessToken)}`);
|
|
421
|
+
console.log(`GitHub Token: ${obfuscateCred(githubToken)}`);
|
|
413
422
|
};
|
|
414
423
|
var run = async () => {
|
|
415
424
|
const command = process.argv[2];
|
|
@@ -489,6 +498,9 @@ var run = async () => {
|
|
|
489
498
|
case "setCustomSearchEngineId":
|
|
490
499
|
await setCustomSearchEngineId();
|
|
491
500
|
break;
|
|
501
|
+
case "setGithubToken":
|
|
502
|
+
await setGithubToken();
|
|
503
|
+
break;
|
|
492
504
|
case "printEnv":
|
|
493
505
|
await printEnv();
|
|
494
506
|
break;
|
|
@@ -519,6 +531,7 @@ export {
|
|
|
519
531
|
getFirestoreProjectId,
|
|
520
532
|
getGcpProjectId,
|
|
521
533
|
getGeminiApiKey,
|
|
534
|
+
getGithubToken,
|
|
522
535
|
getJiraApiBaseUrl,
|
|
523
536
|
getJiraApiToken,
|
|
524
537
|
getJiraUserEmail,
|
|
@@ -549,6 +562,7 @@ export {
|
|
|
549
562
|
setEnvVar,
|
|
550
563
|
setFirestoreProjectId,
|
|
551
564
|
setGeminiApiKey,
|
|
565
|
+
setGithubToken,
|
|
552
566
|
setJiraApiBaseUrl,
|
|
553
567
|
setJiraApiToken,
|
|
554
568
|
setJiraUserEmail,
|
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
|
@@ -431,6 +431,13 @@ const setCustomSearchEngineId = async (): Promise<void> => {
|
|
|
431
431
|
}
|
|
432
432
|
};
|
|
433
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
|
+
|
|
434
441
|
const setFirestoreProjectId = async (): Promise<void> => {
|
|
435
442
|
const firestoreProjectId = await askQuestion('Enter Firestore Project ID', 'dataformer-prod');
|
|
436
443
|
if (firestoreProjectId) {
|
|
@@ -468,6 +475,7 @@ const getConfluenceDefaultSpaceId = async (): Promise<string | null> => await ge
|
|
|
468
475
|
const getGeminiApiKey = async (): Promise<string | null> => await getEnvVar('GEMINI_API_KEY');
|
|
469
476
|
const getNpmToken = async (): Promise<string | null> => await getEnvVar('NPM_TOKEN');
|
|
470
477
|
const getPulumiAccessToken = async (): Promise<string | null> => await getEnvVar('PULUMI_ACCESS_TOKEN');
|
|
478
|
+
const getGithubToken = async (): Promise<string | null> => await getEnvVar('GITHUB_TOKEN');
|
|
471
479
|
|
|
472
480
|
const getProjectRoot = (): string => {
|
|
473
481
|
// When compiled, this will be in dist/services/, so we need to go up two levels
|
|
@@ -512,6 +520,7 @@ const printEnv = async (): Promise<void> => {
|
|
|
512
520
|
const gcpProjectIdVal = await getGcpProjectId();
|
|
513
521
|
const npmToken = await getNpmToken();
|
|
514
522
|
const pulumiAccessToken = await getPulumiAccessToken();
|
|
523
|
+
const githubToken = await getGithubToken();
|
|
515
524
|
|
|
516
525
|
console.log(`Project Root: ${getProjectRoot()}`);
|
|
517
526
|
console.log(`GCP Project ID: ${gcpProjectIdVal}`);
|
|
@@ -540,6 +549,7 @@ const printEnv = async (): Promise<void> => {
|
|
|
540
549
|
console.log(`Gemini API Key: ${obfuscateCred(geminiApiKey)}`);
|
|
541
550
|
console.log(`NPM Token: ${obfuscateCred(npmToken)}`);
|
|
542
551
|
console.log(`Pulumi Access Token: ${obfuscateCred(pulumiAccessToken)}`);
|
|
552
|
+
console.log(`GitHub Token: ${obfuscateCred(githubToken)}`);
|
|
543
553
|
};
|
|
544
554
|
|
|
545
555
|
const run = async (): Promise<void> => {
|
|
@@ -570,6 +580,7 @@ const run = async (): Promise<void> => {
|
|
|
570
580
|
case 'setPulumiAccessToken': await setPulumiAccessToken(); break;
|
|
571
581
|
case 'setCustomSearchApiKey': await setCustomSearchApiKey(); break;
|
|
572
582
|
case 'setCustomSearchEngineId': await setCustomSearchEngineId(); break;
|
|
583
|
+
case 'setGithubToken': await setGithubToken(); break;
|
|
573
584
|
case 'printEnv': await printEnv(); break;
|
|
574
585
|
default: console.log('Unknown command. Available commands: setEnv, setBearerToken, ..., printEnv');
|
|
575
586
|
}
|
|
@@ -617,6 +628,7 @@ export {
|
|
|
617
628
|
setPulumiAccessToken,
|
|
618
629
|
setCustomSearchApiKey,
|
|
619
630
|
setCustomSearchEngineId,
|
|
631
|
+
setGithubToken,
|
|
620
632
|
|
|
621
633
|
// Getters
|
|
622
634
|
getLogToConsole,
|
|
@@ -641,6 +653,7 @@ export {
|
|
|
641
653
|
getGeminiApiKey,
|
|
642
654
|
getNpmToken,
|
|
643
655
|
getPulumiAccessToken,
|
|
656
|
+
getGithubToken,
|
|
644
657
|
|
|
645
658
|
// Synchronous Getters / Utility
|
|
646
659
|
getProjectRoot,
|