diff options
| author | Alexandre Flament <alex@al-f.net> | 2021-01-12 10:52:42 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-01-12 10:52:42 +0100 |
| commit | 9c55d772e98f5e51da4a34389dc240cfb3b14852 (patch) | |
| tree | 50f857bf046ab179eee935d40b9e63da7372171e /searx/__init__.py | |
| parent | 8d0312d014f09fad2133b6e6c6b597cc08e4daf0 (diff) | |
| parent | 424e6abc7e26c3e3be71678d00f88cf09d6c0a7e (diff) | |
Merge pull request #2408 from return42/rm-brand-make
[mod] move brand options from Makefile to settings.yml
Diffstat (limited to 'searx/__init__.py')
| -rw-r--r-- | searx/__init__.py | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/searx/__init__.py b/searx/__init__.py index 08e67f69d..11adbba73 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.get(group, {}).get(name) or default + + @property + def SEARX_URL(self): + return self.get_val('server', 'base_url') + + @property + def CONTACT_URL(self): + return self.get_val('general', 'contact_url') + + @property + def GIT_URL(self): + return self.get_val('brand', 'git_url') + + @property + def GIT_BRANCH(self): + return self.get_val('brand', 'git_branch') + + @property + def ISSUE_URL(self): + return self.get_val('brand', 'issue_url') + + @property + def DOCS_URL(self): + return self.get_val('brand', 'docs_url') + + @property + def PUBLIC_INSTANCES(self): + return self.get_val('brand', 'public_instances') + + @property + def WIKI_URL(self): + return self.get_val('brand', 'wiki_url') + + @property + def TWITTER_URL(self): + return self.get_val('brand', 'twitter_url') + + +brand = _brand_namespace() |