on master help sign in
[mod] settings.yml: move brand settings to a dedicated section
commit424e6abc7e26c3e3be71678d00f88cf09d6c0a7e authorAlexandre Flament <alex@al-f.net> dateMon 11 Jan 2021, 11:49 (6 years ago) parentd588214
2 files changed+15−13
searx/__init__.py+12−12 searx/settings.yml+3−1
searx/__init__.py+12−12
@@ -66,43 +66,43 @@ class _brand_namespace:
6666
6767 @classmethod
6868 def get_val(cls, group, name, default=''):
69− return settings[group].get(name, False) or ''
69+ return settings.get(group, {}).get(name) or default
7070
7171 @property
7272 def SEARX_URL(self):
7373 return self.get_val('server', 'base_url')
7474
75+ @property
76+ def CONTACT_URL(self):
77+ return self.get_val('general', 'contact_url')
78+
7579 @property
7680 def GIT_URL(self):
77− return self.get_val('general', 'git_url')
81+ return self.get_val('brand', 'git_url')
7882
7983 @property
8084 def GIT_BRANCH(self):
81− return self.get_val('general', 'git_branch')
85+ return self.get_val('brand', 'git_branch')
8286
8387 @property
8488 def ISSUE_URL(self):
85− return self.get_val('general', 'issue_url')
89+ return self.get_val('brand', 'issue_url')
8690
8791 @property
8892 def DOCS_URL(self):
89− return self.get_val('general', 'docs_url')
93+ return self.get_val('brand', 'docs_url')
9094
9195 @property
9296 def PUBLIC_INSTANCES(self):
93− return self.get_val('general', 'public_instances')
94−
95− @property
96− def CONTACT_URL(self):
97− return self.get_val('general', 'contact_url')
97+ return self.get_val('brand', 'public_instances')
9898
9999 @property
100100 def WIKI_URL(self):
101− return self.get_val('general', 'wiki_url')
101+ return self.get_val('brand', 'wiki_url')
102102
103103 @property
104104 def TWITTER_URL(self):
105− return self.get_val('general', 'twitter_url')
105+ return self.get_val('brand', 'twitter_url')
106106
107107
108108brand = _brand_namespace()
searx/settings.yml+3−1
@@ -1,12 +1,14 @@
11general:
22 debug : False # Debug mode, only for development
33 instance_name : "searx" # displayed name
4+ contact_url: False # mailto:contact@example.com
5+
6+brand:
47 git_url: https://github.com/searx/searx
58 git_branch: master
69 issue_url: https://github.com/searx/searx/issues
710 docs_url: https://searx.github.io/searx
811 public_instances: https://searx.space
9− contact_url: False # mailto:contact@example.com
1012 wiki_url: https://github.com/searx/searx/wiki
1113 twitter_url: https://twitter.com/Searx_engine
1214