From f6fd57692be12b913d65f70e4d5c68448f1150f2 Mon Sep 17 00:00:00 2001
From: Tim Fechner <tim.fechner@hs-hannover.de>
Date: Fri, 22 Jul 2016 14:36:59 +0200
Subject: [PATCH] Close #22, make everything configurable

---
 salt_observer/cherry.py                   |  4 +++-
 salt_observer/private_settings.example.py | 11 +++++++++++
 salt_observer/views.py                    |  2 +-
 3 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/salt_observer/cherry.py b/salt_observer/cherry.py
index 1e0f5fe..0c6e7b7 100644
--- a/salt_observer/cherry.py
+++ b/salt_observer/cherry.py
@@ -1,10 +1,12 @@
+from django.conf import settings
+
 import requests
 from getpass import getpass
 
 
 class SaltCherrypyApi(object):
 
-    BASE_URL = 'http://localhost:8989'
+    BASE_URL = '{protocol}://{host}:{port}'.format(**settings.SALT_API)
 
     def __init__(self, username, password):
         ''' Log in every time an instance is created '''
diff --git a/salt_observer/private_settings.example.py b/salt_observer/private_settings.example.py
index 77a5673..183b256 100644
--- a/salt_observer/private_settings.example.py
+++ b/salt_observer/private_settings.example.py
@@ -22,3 +22,14 @@ DATABASES = {
         'NAME': os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'db.sqlite3'),
     }
 }
+
+
+# Salt observer configuration
+SALT_API = {
+    'host': 'localhost',
+    'port': 8989,
+    'protocol': 'http',
+}
+
+# specify your salt network here to disable it in network visualization
+SALT_NETWORK = '123.456.789.0'
diff --git a/salt_observer/views.py b/salt_observer/views.py
index 52aef54..bd12a00 100644
--- a/salt_observer/views.py
+++ b/salt_observer/views.py
@@ -85,7 +85,7 @@ class VisualNetwork(TemplateView):
         ctx = super().get_context_data(*args, **kwargs)
         ctx.update({
             'minions': Minion.objects.all(),
-            'networks': Network.objects.all().exclude(ipv4='10.1.10.0'),
+            'networks': Network.objects.all().exclude(ipv4=settings.SALT_NETWORK),
         })
         return ctx
 
-- 
GitLab