summaryrefslogtreecommitdiff
path: root/searx/__init__.py
diff options
context:
space:
mode:
authorMarkus Heiser <markus.heiser@darmarit.de>2020-12-27 14:39:48 +0100
committerMarkus Heiser <markus.heiser@darmarit.de>2021-01-11 22:12:38 +0100
commit9e53470b4cf533b890a2f57debd2f2b4198b4dd1 (patch)
tree5e041304488451cba4548fd386d625dd0cabec3a /searx/__init__.py
parent9485179064b4eb28f2813eba3c295edca3b0db7f (diff)
downloadsearxng-9e53470b4cf533b890a2f57debd2f2b4198b4dd1.tar.gz
searxng-9e53470b4cf533b890a2f57debd2f2b4198b4dd1.zip
[mod] get rid of searx/brand.py
Removes module searx/brand.py and creates a namespace at searx.brand. This patch is a first 'proof of concept'. Later we can decide to remove the brand namespace entirely or not. Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'searx/__init__.py')
-rw-r--r--searx/__init__.py46
1 files changed, 46 insertions, 0 deletions
diff --git a/searx/__init__.py b/searx/__init__.py
index 08e67f69d..7f76022e1 100644
--- a/searx/__init__.py
+++ b/searx/__init__.py
@@ -60,3 +60,49 @@ if 'SEARX_SECRET' in environ:
settings['server']['secret_key'] = environ['SEARX_SECRET']
if 'SEARX_BIND_ADDRESS' in environ:
settings['server']['bind_address'] = environ['SEARX_BIND_ADDRESS']
+
+
+class _brand_namespace:
+
+ @classmethod
+ def get_val(cls, group, name, default=''):
+ return settings[group].get(name, False) or ''
+
+ @property
+ def SEARX_URL(self):
+ return self.get_val('server', 'base_url')
+
+ @property
+ def GIT_URL(self):
+ return self.get_val('general', 'git_url')
+
+ @property
+ def GIT_BRANCH(self):
+ return self.get_val('general', 'git_branch')
+
+ @property
+ def ISSUE_URL(self):
+ return self.get_val('general', 'issue_url')
+
+ @property
+ def DOCS_URL(self):
+ return self.get_val('general', 'docs_url')
+
+ @property
+ def PUBLIC_INSTANCES(self):
+ return self.get_val('general', 'public_instances')
+
+ @property
+ def CONTACT_URL(self):
+ return self.get_val('general', 'contact_url')
+
+ @property
+ def WIKI_URL(self):
+ return self.get_val('general', 'wiki_url')
+
+ @property
+ def TWITTER_URL(self):
+ return self.get_val('general', 'twitter_url')
+
+
+brand = _brand_namespace()