@dataformer/env-service 2.2.0 → 2.3.0
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 +11 -0
- package/dist/index.js +2 -2
- package/package.json +2 -2
- package/src/index.ts +8 -4
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
2
|
import readline from "readline";
|
|
3
3
|
import path from "path";
|
|
4
|
-
import {
|
|
4
|
+
import { SecretManagerClient } from "@dataformer/secret-manager-client";
|
|
5
5
|
var secretManager = null;
|
|
6
6
|
var secretManagerInitialized = false;
|
|
7
7
|
async function getSecretManager() {
|
|
@@ -9,7 +9,7 @@ async function getSecretManager() {
|
|
|
9
9
|
return secretManager;
|
|
10
10
|
}
|
|
11
11
|
try {
|
|
12
|
-
secretManager = await
|
|
12
|
+
secretManager = await SecretManagerClient.create();
|
|
13
13
|
secretManagerInitialized = true;
|
|
14
14
|
return secretManager;
|
|
15
15
|
} catch (error) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dataformer/env-service",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "Environment service for Dataformer",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"@google-cloud/secret-manager": "^5.4.0",
|
|
16
|
-
"@dataformer/secret-manager-client": "^2.
|
|
16
|
+
"@dataformer/secret-manager-client": "^2.3.0"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"tsup": "^8.0.0",
|
package/src/index.ts
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
// EnvService.ts - Manages environment variables and credentials using Google Secret Manager.
|
|
2
2
|
//
|
|
3
3
|
// HOW TO USE:
|
|
4
|
-
// This script
|
|
4
|
+
// This script can be invoked via the wrapper `env.js` in the project root (after building):
|
|
5
5
|
// Commands are passed as arguments, e.g.:
|
|
6
6
|
// node env.js printEnv - Prints all current environment variable values.
|
|
7
|
-
// node env.js
|
|
7
|
+
// node env.js setGeminiApiKey - Prompts to set the Gemini API key.
|
|
8
|
+
// node env.js setPostgresUser - Prompts to set the PostgreSQL user.
|
|
8
9
|
// ... and so on for other specific setters listed in the `run` function's switch statement.
|
|
9
10
|
//
|
|
11
|
+
// Alternatively, you can run it directly from the compiled output:
|
|
12
|
+
// node packages/services/env-service/dist/index.js printEnv
|
|
13
|
+
//
|
|
10
14
|
// GCLOUD AUTHENTICATION REQUIREMENT:
|
|
11
15
|
// This script requires you to be authenticated with Google Cloud CLI (`gcloud`).
|
|
12
16
|
// The credentials are used by the underlying SecretManagerClient to access Google Secret Manager.
|
|
@@ -35,7 +39,7 @@
|
|
|
35
39
|
|
|
36
40
|
import readline from 'readline';
|
|
37
41
|
import path from 'path';
|
|
38
|
-
import {
|
|
42
|
+
import { SecretManagerClient } from '@dataformer/secret-manager-client';
|
|
39
43
|
|
|
40
44
|
// SecretManager client will be initialized lazily on first use
|
|
41
45
|
let secretManager: SecretManagerClient | null = null;
|
|
@@ -47,7 +51,7 @@ async function getSecretManager(): Promise<SecretManagerClient | null> {
|
|
|
47
51
|
}
|
|
48
52
|
|
|
49
53
|
try {
|
|
50
|
-
secretManager = await
|
|
54
|
+
secretManager = await SecretManagerClient.create();
|
|
51
55
|
secretManagerInitialized = true;
|
|
52
56
|
return secretManager;
|
|
53
57
|
} catch (error) {
|