mirror of
https://github.com/searxng/searxng
synced 2024-01-01 18:24:07 +00:00
[mod] move brand options from Makefile to settings.yml
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
parent
dbfd5567aa
commit
9485179064
34
Makefile
34
Makefile
@ -1,14 +1,6 @@
|
||||
# -*- coding: utf-8; mode: makefile-gmake -*-
|
||||
.DEFAULT_GOAL=help
|
||||
|
||||
# START Makefile setup
|
||||
export GIT_URL=https://github.com/searx/searx
|
||||
export GIT_BRANCH=master
|
||||
export SEARX_URL=https://searx.me
|
||||
export DOCS_URL=https://searx.github.io/searx
|
||||
# export CONTACT_URL=mailto:contact@example.com
|
||||
# END Makefile setup
|
||||
|
||||
include utils/makefile.include
|
||||
|
||||
PYOBJECTS = searx
|
||||
@ -43,12 +35,6 @@ help-min:
|
||||
@echo ' docker - build Docker image'
|
||||
@echo ' node.env - download & install npm dependencies locally'
|
||||
@echo ''
|
||||
@echo 'environment'
|
||||
@echo ' SEARX_URL = $(SEARX_URL)'
|
||||
@echo ' GIT_URL = $(GIT_URL)'
|
||||
@echo ' DOCS_URL = $(DOCS_URL)'
|
||||
@echo ' CONTACT_URL = $(CONTACT_URL)'
|
||||
@echo ''
|
||||
@$(MAKE) -e -s make-help
|
||||
|
||||
help-all: help-min
|
||||
@ -118,24 +104,8 @@ useragents.update: pyenvinstall
|
||||
$(Q)echo "Update searx/data/useragents.json with the most recent versions of Firefox."
|
||||
$(Q)$(PY_ENV_ACT); python utils/fetch_firefox_version.py
|
||||
|
||||
buildenv:
|
||||
$(Q)echo "build searx/brand.py"
|
||||
$(Q)echo "GIT_URL = '$(GIT_URL)'" > searx/brand.py
|
||||
$(Q)echo "GIT_BRANCH = '$(GIT_BRANCH)'" >> searx/brand.py
|
||||
$(Q)echo "ISSUE_URL = 'https://github.com/searx/searx/issues'" >> searx/brand.py
|
||||
$(Q)echo "SEARX_URL = '$(SEARX_URL)'" >> searx/brand.py
|
||||
$(Q)echo "DOCS_URL = '$(DOCS_URL)'" >> searx/brand.py
|
||||
$(Q)echo "PUBLIC_INSTANCES = 'https://searx.space'" >> searx/brand.py
|
||||
$(Q)echo "CONTACT_URL = '$(CONTACT_URL)'" >> searx/brand.py
|
||||
$(Q)echo "build utils/brand.env"
|
||||
$(Q)echo "export GIT_URL='$(GIT_URL)'" > utils/brand.env
|
||||
$(Q)echo "export GIT_BRANCH='$(GIT_BRANCH)'" >> utils/brand.env
|
||||
$(Q)echo "export ISSUE_URL='https://github.com/searx/searx/issues'" >> utils/brand.env
|
||||
$(Q)echo "export SEARX_URL='$(SEARX_URL)'" >> utils/brand.env
|
||||
$(Q)echo "export DOCS_URL='$(DOCS_URL)'" >> utils/brand.env
|
||||
$(Q)echo "export PUBLIC_INSTANCES='https://searx.space'" >> utils/brand.env
|
||||
$(Q)echo "export CONTACT_URL='$(CONTACT_URL)'" >> utils/brand.env
|
||||
|
||||
buildenv: pyenv
|
||||
$(Q)$(PY_ENV_ACT); SEARX_DEBUG=1 python utils/build_env.py
|
||||
|
||||
# node / npm
|
||||
# ----------
|
||||
|
@ -76,6 +76,6 @@ If all services are running fine, you can add it to your HTTP server:
|
||||
.. tip::
|
||||
|
||||
About script's installation options have a look at chapter :ref:`toolboxing
|
||||
setup`. How to brand your instance see chapter :ref:`makefile setup`. To
|
||||
setup`. How to brand your instance see chapter :ref:`settings global`. To
|
||||
*stash* your instance's setup, `git stash`_ your clone's :origin:`Makefile`
|
||||
and :origin:`.config.sh` file .
|
||||
|
@ -40,11 +40,35 @@ Global Settings
|
||||
general:
|
||||
debug : False # Debug mode, only for development
|
||||
instance_name : "searx" # displayed name
|
||||
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
|
||||
contact_url: False # mailto:contact@example.com
|
||||
wiki_url: https://github.com/searx/searx/wiki
|
||||
twitter_url: https://twitter.com/Searx_engine
|
||||
|
||||
``debug`` :
|
||||
Allow a more detailed log if you run searx directly. Display *detailed* error
|
||||
messages in the browser too, so this must be deactivated in production.
|
||||
|
||||
``contact_url``:
|
||||
Contact mail address or WEB form.
|
||||
|
||||
``git_url`` and ``git_branch``:
|
||||
Changes this, to point to your searx fork (branch).
|
||||
|
||||
``docs_url``
|
||||
If you host your own documentation, change this URL.
|
||||
|
||||
``wiki_url``:
|
||||
Link to your wiki (or ``False``)
|
||||
|
||||
``twitter_url``:
|
||||
Link to your tweets (or ``False``)
|
||||
|
||||
|
||||
.. code:: yaml
|
||||
|
||||
server:
|
||||
|
@ -259,8 +259,8 @@ suite. For this, we have to keep an eye on the :ref:`installation basic`:
|
||||
- virtualenv in: ``/usr/local/searx/searx-pyenv``
|
||||
- searx software in: ``/usr/local/searx/searx-src``
|
||||
|
||||
The searx software is a clone of the ``GIT_URL`` (see :ref:`makefile setup`) and
|
||||
the working tree is checked out from the ``GIT_BRANCH``. With the use of the
|
||||
The searx software is a clone of the ``git_url`` (see :ref:`settings global`) and
|
||||
the working tree is checked out from the ``git_branch``. With the use of the
|
||||
:ref:`searx.sh` the searx service was installed as :ref:`uWSGI application
|
||||
<searx uwsgi>`. To maintain this service, we can use ``systemctl`` (compare
|
||||
:ref:`service architectures on distributions <uwsgi configuration>`).
|
||||
|
38
docs/conf.py
38
docs/conf.py
@ -2,14 +2,10 @@
|
||||
|
||||
import sys, os
|
||||
from sphinx_build_tools import load_sphinx_config
|
||||
from searx.version import VERSION_STRING
|
||||
from pallets_sphinx_themes import ProjectLink
|
||||
|
||||
from searx.brand import GIT_URL
|
||||
GIT_BRANCH = os.environ.get("GIT_BRANCH", "master")
|
||||
from searx.brand import SEARX_URL
|
||||
from searx.brand import DOCS_URL
|
||||
|
||||
from searx import brand
|
||||
from searx.version import VERSION_STRING
|
||||
|
||||
# Project --------------------------------------------------------------
|
||||
|
||||
@ -46,10 +42,10 @@ extlinks['wiki'] = ('https://github.com/searx/searx/wiki/%s', ' ')
|
||||
extlinks['pull'] = ('https://github.com/searx/searx/pull/%s', 'PR ')
|
||||
|
||||
# links to custom brand
|
||||
extlinks['origin'] = (GIT_URL + '/blob/' + GIT_BRANCH + '/%s', 'git://')
|
||||
extlinks['patch'] = (GIT_URL + '/commit/%s', '#')
|
||||
extlinks['search'] = (SEARX_URL + '/%s', '#')
|
||||
extlinks['docs'] = (DOCS_URL + '/%s', 'docs: ')
|
||||
extlinks['origin'] = (brand.GIT_URL + '/blob/' + brand.GIT_BRANCH + '/%s', 'git://')
|
||||
extlinks['patch'] = (brand.GIT_URL + '/commit/%s', '#')
|
||||
extlinks['search'] = (brand.SEARX_URL + '/%s', '#')
|
||||
extlinks['docs'] = (brand.DOCS_URL + '/%s', 'docs: ')
|
||||
extlinks['pypi'] = ('https://pypi.org/project/%s', 'PyPi: ')
|
||||
extlinks['man'] = ('https://manpages.debian.org/jump?q=%s', '')
|
||||
#extlinks['role'] = (
|
||||
@ -104,14 +100,20 @@ imgmath_font_size = 14
|
||||
# sphinx.ext.imgmath setup END
|
||||
|
||||
html_theme_options = {"index_sidebar_logo": True}
|
||||
html_context = {
|
||||
"project_links": [
|
||||
ProjectLink("Source", GIT_URL),
|
||||
ProjectLink("Wiki", "https://github.com/searx/searx/wiki"),
|
||||
ProjectLink("Public instances", "https://searx.space/"),
|
||||
ProjectLink("Twitter", "https://twitter.com/Searx_engine"),
|
||||
]
|
||||
}
|
||||
html_context = {"project_links": [] }
|
||||
if brand.GIT_URL:
|
||||
html_context["project_links"].append(ProjectLink("Source", brand.GIT_URL))
|
||||
if brand.WIKI_URL:
|
||||
html_context["project_links"].append(ProjectLink("Wiki", brand.WIKI_URL))
|
||||
if brand.PUBLIC_INSTANCES:
|
||||
html_context["project_links"].append(ProjectLink("Public instances", brand.PUBLIC_INSTANCES))
|
||||
if brand.TWITTER_URL:
|
||||
html_context["project_links"].append(ProjectLink("Twitter", brand.TWITTER_URL))
|
||||
if brand.ISSUE_URL:
|
||||
html_context["project_links"].append(ProjectLink("Issue Tracker", brand.ISSUE_URL))
|
||||
if brand.CONTACT_URL:
|
||||
html_context["project_links"].append(ProjectLink("Contact", brand.CONTACT_URL))
|
||||
|
||||
html_sidebars = {
|
||||
"**": ["project.html", "relations.html", "searchbox.html"],
|
||||
}
|
||||
|
@ -8,8 +8,7 @@ Makefile Targets
|
||||
|
||||
.. sidebar:: build environment
|
||||
|
||||
Before looking deeper at the targets, first read about :ref:`makefile setup`
|
||||
and :ref:`make pyenv`.
|
||||
Before looking deeper at the targets, first read about :ref:`make pyenv`.
|
||||
|
||||
To install system requirements follow :ref:`buildhosts`.
|
||||
|
||||
@ -28,37 +27,6 @@ Calling the ``help`` target gives a first overview (``make help``):
|
||||
:local:
|
||||
:backlinks: entry
|
||||
|
||||
|
||||
.. _makefile setup:
|
||||
|
||||
Makefile setup
|
||||
==============
|
||||
|
||||
.. _git stash: https://git-scm.com/docs/git-stash
|
||||
|
||||
.. sidebar:: fork & upstream
|
||||
|
||||
Commit changes in your (local) branch, fork or whatever, but do not push them
|
||||
upstream / `git stash`_ is your friend.
|
||||
|
||||
The main setup is done in the :origin:`Makefile`.
|
||||
|
||||
.. literalinclude:: ../../Makefile
|
||||
:start-after: START Makefile setup
|
||||
:end-before: END Makefile setup
|
||||
|
||||
:GIT_URL: Changes this, to point to your searx fork.
|
||||
:GIT_BRANCH: Changes this, to point to your searx branch.
|
||||
:SEARX_URL: Changes this, to point to your searx instance.
|
||||
:DOCS_URL: If you host your own (*brand*) documentation, change this URL.
|
||||
|
||||
If you change any of this build environment variables, you have to run ``make
|
||||
buildenv``::
|
||||
|
||||
$ make buildenv
|
||||
build searx/brand.py
|
||||
build utils/brand.env
|
||||
|
||||
.. _make pyenv:
|
||||
|
||||
Python environment
|
||||
@ -148,7 +116,7 @@ clean`` stop all processes using :ref:`make pyenv`.
|
||||
We describe the usage of the ``doc*`` targets in the :ref:`How to contribute /
|
||||
Documentation <contrib docs>` section. If you want to edit the documentation
|
||||
read our :ref:`make docs-live` section. If you are working in your own brand,
|
||||
adjust your :ref:`Makefile setup <makefile setup>`.
|
||||
adjust your :ref:`settings global`.
|
||||
|
||||
.. _make books:
|
||||
|
||||
@ -185,8 +153,8 @@ Use ``make docs-help`` to see which books available:
|
||||
``make gh-pages``
|
||||
=================
|
||||
|
||||
To deploy on github.io first adjust your :ref:`Makefile setup <makefile
|
||||
setup>`. For any further read :ref:`deploy on github.io`.
|
||||
To deploy on github.io first adjust your :ref:`settings global`. For any
|
||||
further read :ref:`deploy on github.io`.
|
||||
|
||||
.. _make test:
|
||||
|
||||
|
@ -47,8 +47,8 @@ Scripts to maintain services often dispose of common commands and environments.
|
||||
Tooling box setup
|
||||
=================
|
||||
|
||||
The main setup is done in the :origin:`.config.sh` (read also :ref:`makefile
|
||||
setup`).
|
||||
The main setup is done in the :origin:`.config.sh` (read also :ref:`settings
|
||||
global`).
|
||||
|
||||
.. literalinclude:: ../../.config.sh
|
||||
:language: bash
|
||||
|
@ -1,7 +1,9 @@
|
||||
SEARX_URL = ''
|
||||
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 = ''
|
||||
WIKI_URL = 'https://github.com/searx/searx/wiki'
|
||||
TWITTER_URL = 'https://twitter.com/Searx_engine'
|
||||
|
@ -1,6 +1,14 @@
|
||||
general:
|
||||
debug : False # Debug mode, only for development
|
||||
instance_name : "searx" # displayed name
|
||||
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
|
||||
contact_url: False # mailto:contact@example.com
|
||||
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
|
||||
|
@ -1,7 +1,9 @@
|
||||
export SEARX_URL=''
|
||||
export GIT_URL='https://github.com/searx/searx'
|
||||
export GIT_BRANCH='master'
|
||||
export ISSUE_URL='https://github.com/searx/searx/issues'
|
||||
export SEARX_URL='https://searx.me'
|
||||
export DOCS_URL='https://searx.github.io/searx'
|
||||
export PUBLIC_INSTANCES='https://searx.space'
|
||||
export CONTACT_URL=''
|
||||
export WIKI_URL='https://github.com/searx/searx/wiki'
|
||||
export TWITTER_URL='https://twitter.com/Searx_engine'
|
||||
|
42
utils/build_env.py
Normal file
42
utils/build_env.py
Normal file
@ -0,0 +1,42 @@
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
"""build environment used by shell scripts
|
||||
"""
|
||||
|
||||
# set path
|
||||
import sys
|
||||
from os.path import realpath, dirname, join, sep
|
||||
repo_root = realpath(dirname(realpath(__file__)) + sep + '..')
|
||||
sys.path.insert(0, repo_root)
|
||||
|
||||
from searx.settings_loader import load_settings
|
||||
|
||||
settings, settings_load_message = load_settings()
|
||||
print(settings_load_message)
|
||||
|
||||
brand_env = 'utils' + sep + 'brand.env'
|
||||
brand_py = 'searx' + sep + 'brand.py'
|
||||
|
||||
def get_val(group, name, default=''):
|
||||
return settings[group].get(name, False) or ''
|
||||
|
||||
name_val = [
|
||||
('SEARX_URL' , get_val('server', 'base_url')),
|
||||
('GIT_URL' , get_val('general','git_url')),
|
||||
('GIT_BRANCH' , get_val('general','git_branch')),
|
||||
('ISSUE_URL' , get_val('general','issue_url')),
|
||||
('DOCS_URL' , get_val('general','docs_url')),
|
||||
('PUBLIC_INSTANCES' , get_val('general','public_instances')),
|
||||
('CONTACT_URL' , get_val('general','contact_url')),
|
||||
('WIKI_URL' , get_val('general','wiki_url')),
|
||||
('TWITTER_URL' , get_val('general','twitter_url')),
|
||||
]
|
||||
|
||||
print('build %s' % brand_env)
|
||||
with open(repo_root + sep + brand_env, 'w', encoding='utf-8') as f:
|
||||
for name, val in name_val:
|
||||
print("export %s='%s'" % (name, val), file=f)
|
||||
|
||||
print('build %s' % brand_py)
|
||||
with open(repo_root + sep + brand_py, 'w', encoding='utf-8') as f:
|
||||
for name, val in name_val:
|
||||
print("%s = '%s'" % (name, val), file=f)
|
Loading…
Reference in New Issue
Block a user