From 1db95c9ac1de08d334df726c41319cb347100446 Mon Sep 17 00:00:00 2001
From: sovrgn <boyan.tsolov@vereign.com>
Date: Thu, 21 Mar 2024 16:36:10 +0200
Subject: [PATCH] chore: move configuration variables to env

---
 .env.example                  |  5 +++++
 libs/askar/src/agent.utils.ts | 17 +++++++++++++----
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/.env.example b/.env.example
index bd94b654..3eff346f 100644
--- a/.env.example
+++ b/.env.example
@@ -37,3 +37,8 @@ PROOF_SERVICE_HOST=0.0.0.0
 
 ALLOWED_ORIGINS=*
 SWAGGER=false
+
+TAILS_SERVER_BASE_URL=https://s3.us-west-000.backblazeb2.com
+TAILS_SERVER_KEY=key
+TAILS_SERVER_SECRET=secret
+TAILS_SERVER_BUCKET_NAME=ssi-revocation-tails
\ No newline at end of file
diff --git a/libs/askar/src/agent.utils.ts b/libs/askar/src/agent.utils.ts
index 989c2676..a254f49c 100644
--- a/libs/askar/src/agent.utils.ts
+++ b/libs/askar/src/agent.utils.ts
@@ -210,10 +210,19 @@ export const generateDidFromKey = (key: Key): string => {
 
 //eslint-disable-next-line
 export const getAskarAnonCredsIndyModules = (networks: any) => {
-  const tailsServerBaseUrl = 'https://s3.us-west-000.backblazeb2.com';
-  const s3AccessKey = '00035e7ca9a9853000000000d';
-  const s3Secret = 'K000e++ZchAncs27jCueO+P+M1UEN2Q';
-  const tailsServerBucketName = 'ssi-revocation-tails';
+  const tailsServerBaseUrl = process.env["TAILS_SERVER_BASE_URL"] || undefined;
+  const s3AccessKey = process.env["TAILS_SERVER_KEY"] || undefined;
+  const s3Secret = process.env["TAILS_SERVER_SECRET"] || undefined;
+  const tailsServerBucketName = process.env["TAILS_SERVER_BUCKET_NAME"] || undefined;
+
+  if (
+    !tailsServerBaseUrl ||
+    !s3AccessKey ||
+    !s3Secret ||
+    !tailsServerBucketName
+  ) {
+    throw new Error("Tails Storage Information not provided.");
+  }
 
   return {
     connections: new ConnectionsModule({
-- 
GitLab