From 87cc117c1dba3ca5f703f8513807668eff2bdd20 Mon Sep 17 00:00:00 2001
From: Antoine Lambert <anlambert@softwareheritage.org>
Date: Tue, 14 Mar 2023 13:59:38 +0100
Subject: [PATCH] docker: Activate graphql authentication when keycloak is
 available

It enables to test graphql authentication feature in the docker environment.
---
 docker/conf/graphql-keycloak.yml   | 23 +++++++++++++++++++++++
 docker/docker-compose.keycloak.yml |  7 +++++++
 2 files changed, 30 insertions(+)
 create mode 100644 docker/conf/graphql-keycloak.yml

diff --git a/docker/conf/graphql-keycloak.yml b/docker/conf/graphql-keycloak.yml
new file mode 100644
index 0000000..12c6e09
--- /dev/null
+++ b/docker/conf/graphql-keycloak.yml
@@ -0,0 +1,23 @@
+storage:
+  cls: remote
+  url: http://swh-storage:5002
+
+search:
+  cls: remote
+  url: http://swh-search:5010/
+
+debug: yes
+
+introspection: yes
+
+max_query_cost:
+  anonymous: 500
+  user: 50000
+
+auth:
+  server: http://keycloak:8080/keycloak/auth/
+  realm: SoftwareHeritage
+  client: swh-web
+  cache:
+    # used to cache auth tokens
+    url: memcached://memcache:11211
diff --git a/docker/docker-compose.keycloak.yml b/docker/docker-compose.keycloak.yml
index 37f76ce..d6b1973 100644
--- a/docker/docker-compose.keycloak.yml
+++ b/docker/docker-compose.keycloak.yml
@@ -43,3 +43,10 @@ services:
     volumes:
       - "./conf/deposit-keycloak.yml:/deposit-keycloak.yml:ro"
 
+  swh-graphql:
+    depends_on:
+      - keycloak
+    environment:
+      SWH_CONFIG_FILENAME: /graphql-keycloak.yml
+    volumes:
+      - "./conf/graphql-keycloak.yml:/graphql-keycloak.yml:ro"
-- 
GitLab