From 9d5a080fc5e67835c1e94bd6eeaa51ef8e4fb015 Mon Sep 17 00:00:00 2001
From: Yohann D'ANELLO <ynerant@crans.org>
Date: Thu, 14 Jan 2021 12:08:02 +0100
Subject: [PATCH] [thelounge] Support zamok configuration

Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
---
 group_vars/irc.yml                     |  3 +++
 host_vars/zamok.adm.crans.org.yml      |  3 +++
 hosts                                  |  1 +
 roles/thelounge/templates/config.js.j2 | 10 +++++-----
 4 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/group_vars/irc.yml b/group_vars/irc.yml
index cdfc1ffb..e55af642 100644
--- a/group_vars/irc.yml
+++ b/group_vars/irc.yml
@@ -1,5 +1,8 @@
 glob_thelounge:
   public: "false"
+  host: "undefined"
+  reverseProxy: "false"
+  oidentd: "null"
   irc:
     name: Crans
     host: irc.crans.org
diff --git a/host_vars/zamok.adm.crans.org.yml b/host_vars/zamok.adm.crans.org.yml
index 34e0ed9b..8949c4df 100644
--- a/host_vars/zamok.adm.crans.org.yml
+++ b/host_vars/zamok.adm.crans.org.yml
@@ -10,4 +10,7 @@ loc_borg:
         - "  password: {{ vault.mysql_zamok_password }}"
 
 loc_thelounge:
+  host: "\"172.16.10.31\""
+  oidentd: "\"/usr/local/lib/thelounge/.oidentd.conf\""
+  reverseProxy: "true"
   ldap_enable: "true"
diff --git a/hosts b/hosts
index 13bbcb8b..d7bde7ff 100644
--- a/hosts
+++ b/hosts
@@ -64,6 +64,7 @@ horde.adm.crans.org
 
 [irc]
 irc.adm.crans.org
+zamok.adm.crans.org
 
 [keepalived:children]
 routeurs_vm
diff --git a/roles/thelounge/templates/config.js.j2 b/roles/thelounge/templates/config.js.j2
index e7d43fcf..3dd10515 100644
--- a/roles/thelounge/templates/config.js.j2
+++ b/roles/thelounge/templates/config.js.j2
@@ -26,7 +26,7 @@ module.exports = {
 	// For UNIX domain sockets, use `"unix:/absolute/path/to/file.sock"`.
 	//
 	// This value is set to `undefined` by default to listen on all interfaces.
-	host: undefined,
+	host: {{ thelounge.host }},
 
 	// ### `port`
 	//
@@ -49,7 +49,7 @@ module.exports = {
 	// and will honor the `X-Forwarded-For` header.
 	//
 	// This value is set to `false` by default.
-	reverseProxy: false,
+	reverseProxy: {{ thelounge.reverseProxy }},
 
 	// ### `maxHistory`
 	//
@@ -108,7 +108,7 @@ module.exports = {
 	// from URLs posted in channels and private messages.
 	//
 	// This value is set to `false` by default.
-	prefetch: false,
+	prefetch: true,
 
 	// ### `disableMediaPreview`
 	//
@@ -140,7 +140,7 @@ module.exports = {
 	// restarts.
 	//
 	// This value is set to `false` by default.
-	prefetchStorage: false,
+	prefetchStorage: true,
 
 	// ### `prefetchMaxImageSize`
 	//
@@ -351,7 +351,7 @@ module.exports = {
 	// configuration file located at the given path.
 	//
 	// This is set to `null` by default to disable `oidentd` support.
-	oidentd: null,
+	oidentd: {{ thelounge.oidentd }},
 
 	// ## LDAP support