From b792f45cd1db3bcf27f5329df05d93adb3fa9372 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Florent=20Thi=C3=A9ry?= <florent.thiery@ubicast.eu>
Date: Fri, 19 May 2017 16:48:07 +0200
Subject: [PATCH] add envsetup for ubicast web configuration interface, refs
 #21550

---
 .../4.configuration_webinterface/0_setup.py   | 19 +++++++++++++++++++
 .../webconf.json.template                     |  5 +++++
 2 files changed, 24 insertions(+)
 create mode 100644 1.Base/4.configuration_webinterface/0_setup.py
 create mode 100644 1.Base/4.configuration_webinterface/webconf.json.template

diff --git a/1.Base/4.configuration_webinterface/0_setup.py b/1.Base/4.configuration_webinterface/0_setup.py
new file mode 100644
index 00000000..75294f2d
--- /dev/null
+++ b/1.Base/4.configuration_webinterface/0_setup.py
@@ -0,0 +1,19 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+import utils
+
+
+def setup(interactive=True):
+    # Create / update admin account
+    utils.log('Checking admin account')
+    cmds = list()
+    cmds.append('apt-get install python3-ubicast-webconf')
+    # Set password if any
+    settings = {
+        "password": utils.get_conf('WEBCONF_PWD', 'changeme'),
+        "port": utils.get_conf('WEBCONF_PORT', '9999'),
+    }
+    with open('webconf.json.template', 'r') as f:
+        d = f.read()
+    with open('/etc/webconf.json', 'w') as f:
+        f.write(d.format(**settings))
diff --git a/1.Base/4.configuration_webinterface/webconf.json.template b/1.Base/4.configuration_webinterface/webconf.json.template
new file mode 100644
index 00000000..0de2dbfd
--- /dev/null
+++ b/1.Base/4.configuration_webinterface/webconf.json.template
@@ -0,0 +1,5 @@
+{
+    "listen_ip": "0.0.0.0",
+    "password": "{password}",
+    "port": {port}
+}
-- 
GitLab