From f066e1813edccb92f5d856ce27cbbc79abb4d085 Mon Sep 17 00:00:00 2001
From: Yordan Kinkov <yordan.kinkov@vereign.com>
Date: Thu, 23 Nov 2023 11:05:31 +0200
Subject: [PATCH] Add event subscription data for task service

---
 docker-compose.yml                            |  2 +-
 env/policy.env                                |  4 ++--
 env/task.env                                  |  1 +
 .../docker-entrypoint-initdb.d/mongo-init.js  | 22 +++++++++++++++++++
 4 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/docker-compose.yml b/docker-compose.yml
index b8537bc..386c673 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -26,7 +26,7 @@ services:
     env_file:
       - ./env/policy.env
     environment:
-      - USE_NGROK=true
+      - USE_NGROK=false
       - NGROK_TOKEN=${NGROK_TOKEN}
       - NGROK_STATIC_DOMAIN=${NGROK_STATIC_DOMAIN}
     ports:
diff --git a/env/policy.env b/env/policy.env
index 906999e..2bddd0e 100644
--- a/env/policy.env
+++ b/env/policy.env
@@ -4,8 +4,8 @@ HTTP_PORT="8080"
 HTTP_IDLE_TIMEOUT="120s"
 HTTP_READ_TIMEOUT="10s"
 HTTP_WRITE_TIMEOUT="10s"
-#MONGO_ADDR="mongodb://mongo:27017/policy?replicaSet=rs0&authSource=admin"
-POLICY_REPOSITORY_CLONE_URL="https://gitlab.eclipse.org/eclipse/xfsc/tsa/policies.git"
+MONGO_ADDR="mongodb://mongo:27017/policy?replicaSet=rs0&authSource=admin"
+#POLICY_REPOSITORY_CLONE_URL="https://gitlab.eclipse.org/eclipse/xfsc/tsa/policies.git"
 MONGO_USER="root"
 MONGO_PASS="root"
 MONGO_DBNAME="policy"
diff --git a/env/task.env b/env/task.env
index 12c0a0f..80cfd14 100644
--- a/env/task.env
+++ b/env/task.env
@@ -15,3 +15,4 @@ AUTH_REFRESH_INTERVAL="1h"
 OAUTH_CLIENT_ID="workspace"
 OAUTH_CLIENT_SECRET="79bdTGYCKLz9wYSY61vpQF5d4CyZBpsZ"
 OAUTH_TOKEN_URL="http://keycloak:8080/realms/workspace/protocol/openid-connect/token"
+NATS_ADDR="nats:4222"
diff --git a/mongo/docker-entrypoint-initdb.d/mongo-init.js b/mongo/docker-entrypoint-initdb.d/mongo-init.js
index 2c6b50a..4cb8469 100644
--- a/mongo/docker-entrypoint-initdb.d/mongo-init.js
+++ b/mongo/docker-entrypoint-initdb.d/mongo-init.js
@@ -118,6 +118,16 @@ db.taskTemplates.insertMany(
             "finalPolicy": "",
             "cacheNamespace": "",
             "cacheScope": ""
+        },
+        {
+            "name": "cacheEventTask",
+            "url": "",
+            "requestPolicy": "policies/example/cacheEvent/1.0",
+            "method": null,
+            "responsePolicy": "",
+            "finalPolicy": "",
+            "cacheNamespace": "",
+            "cacheScope": ""
         }
     ]
 );
@@ -217,6 +227,18 @@ db.taskListTemplates.insertMany(
     ]
 );
 
+db.createCollection('eventTasks');
+db.eventTasks.insertMany(
+    [
+        {
+            "key": "did:web:did.actor:alice",
+            "namespace": "Login",
+            "scope": "Administration",
+            "taskName": "cacheEventTask"
+        }
+    ]
+);
+
 db = db.getSiblingDB('infohub');
 db.createCollection('exports');
 db.exports.insertMany(
-- 
GitLab