Merge pull request #2408 from return42/rm-brand-make

[mod] move brand options from Makefile to settings.yml
This commit is contained in:
Alexandre Flament 2021-01-12 10:52:42 +01:00 committed by GitHub
commit 9c55d772e9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 239 additions and 152 deletions

View file

@ -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()

View file

@ -1,7 +0,0 @@
GIT_URL = 'https://github.com/searx/searx'
GIT_BRANCH = 'master'
ISSUE_URL = 'https://github.com/searx/searx/issues'
SEARX_URL = 'https://searx.me'
DOCS_URL = 'https://searx.github.io/searx'
PUBLIC_INSTANCES = 'https://searx.space'
CONTACT_URL = ''

View file

@ -1,6 +1,16 @@
general:
debug : False # Debug mode, only for development
instance_name : "searx" # displayed name
contact_url: False # mailto:contact@example.com
brand:
git_url: https://github.com/searx/searx
git_branch: master
issue_url: https://github.com/searx/searx/issues
docs_url: https://searx.github.io/searx
public_instances: https://searx.space
wiki_url: https://github.com/searx/searx/wiki
twitter_url: https://twitter.com/Searx_engine
search:
safe_search : 0 # Filter results. 0: None, 1: Moderate, 2: Strict

View file

@ -1071,6 +1071,7 @@ def config():
'default_theme': settings['ui']['default_theme'],
'version': VERSION_STRING,
'brand': {
'CONTACT_URL': brand.CONTACT_URL,
'GIT_URL': brand.GIT_URL,
'DOCS_URL': brand.DOCS_URL
},