@riocrypto/common-server 1.0.2760 → 1.0.2762

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.
@@ -42,18 +42,24 @@ class SecretManagerClient {
42
42
  this.secretCache = null;
43
43
  this.POLL_INTERVAL_MS = 60 * 60 * 1000; // 1 hour
44
44
  const secretFilePath = "/etc/secrets/secret-manager/secret-manager-service-account-key.json";
45
- const secretFileContents = fs.readFileSync(secretFilePath, "utf8");
46
- const secretData = JSON.parse(secretFileContents);
47
- this.projectId = secretData.project_id;
48
- const clientEmail = secretData.client_email;
49
- const privateKey = secretData.private_key;
50
- this.client = new secret_manager_1.SecretManagerServiceClient({
51
- projectId: this.projectId,
52
- credentials: {
53
- client_email: clientEmail,
54
- private_key: privateKey,
55
- },
56
- });
45
+ if (fs.existsSync(secretFilePath)) {
46
+ const secretFileContents = fs.readFileSync(secretFilePath, "utf8");
47
+ const secretData = JSON.parse(secretFileContents);
48
+ this.projectId = secretData.project_id;
49
+ this.client = new secret_manager_1.SecretManagerServiceClient({
50
+ projectId: this.projectId,
51
+ credentials: {
52
+ client_email: secretData.client_email,
53
+ private_key: secretData.private_key,
54
+ },
55
+ });
56
+ }
57
+ else {
58
+ this.projectId = process.env.GCP_PROJECT_ID || "riocrypto";
59
+ this.client = new secret_manager_1.SecretManagerServiceClient({
60
+ projectId: this.projectId,
61
+ });
62
+ }
57
63
  }
58
64
  /**
59
65
  * Get a secret value from cache or fetch the entire secret file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common-server",
3
- "version": "1.0.2760",
3
+ "version": "1.0.2762",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
@@ -24,7 +24,7 @@
24
24
  "@google-cloud/secret-manager": "^5.6.0",
25
25
  "@google-cloud/storage": "^7.19.0",
26
26
  "@hyperdx/node-opentelemetry": "^0.10.3",
27
- "@riocrypto/common": "^1.0.2554",
27
+ "@riocrypto/common": "1.0.2558",
28
28
  "@slack/web-api": "^7.15.0",
29
29
  "@types/express": "^4.17.25",
30
30
  "axios": "1.13.6",