[mod] settings.yml: move brand settings to a dedicated section

This commit is contained in:
Alexandre Flament 2021-01-11 11:49:06 +01:00 committed by Markus Heiser
parent d5882147e0
commit 424e6abc7e
2 changed files with 26 additions and 24 deletions

View File

@ -66,43 +66,43 @@ class _brand_namespace:
@classmethod @classmethod
def get_val(cls, group, name, default=''): def get_val(cls, group, name, default=''):
return settings[group].get(name, False) or '' return settings.get(group, {}).get(name) or default
@property @property
def SEARX_URL(self): def SEARX_URL(self):
return self.get_val('server', 'base_url') 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 @property
def CONTACT_URL(self): def CONTACT_URL(self):
return self.get_val('general', 'contact_url') 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 @property
def WIKI_URL(self): def WIKI_URL(self):
return self.get_val('general', 'wiki_url') return self.get_val('brand', 'wiki_url')
@property @property
def TWITTER_URL(self): def TWITTER_URL(self):
return self.get_val('general', 'twitter_url') return self.get_val('brand', 'twitter_url')
brand = _brand_namespace() brand = _brand_namespace()

View File

@ -1,12 +1,14 @@
general: general:
debug : False # Debug mode, only for development debug : False # Debug mode, only for development
instance_name : "searx" # displayed name instance_name : "searx" # displayed name
contact_url: False # mailto:contact@example.com
brand:
git_url: https://github.com/searx/searx git_url: https://github.com/searx/searx
git_branch: master git_branch: master
issue_url: https://github.com/searx/searx/issues issue_url: https://github.com/searx/searx/issues
docs_url: https://searx.github.io/searx docs_url: https://searx.github.io/searx
public_instances: https://searx.space public_instances: https://searx.space
contact_url: False # mailto:contact@example.com
wiki_url: https://github.com/searx/searx/wiki wiki_url: https://github.com/searx/searx/wiki
twitter_url: https://twitter.com/Searx_engine twitter_url: https://twitter.com/Searx_engine