1
0
Fork 0
mirror of https://github.com/searxng/searxng.git synced 2024-12-29 12:40:30 +00:00
searxng/docs/admin/api.rst
Markus Heiser f61c918dd4 [mod] normalize .config.sh with settings.yml
In commit 94851790 we have centralized all SearXNG setups in the settings.yml
file:

  94851790 [mod] move brand options from Makefile to settings.yml

This step has not yet been completed for the installation procedures!  Since all
SearXNG setups are done in the settings.yml these environment variables needs to
be removed from the ./conf.sh file.  Scripts and other tasks running outside of
an instance got the needed values from the ./utils/brand.env file.

By example: ATM the environment variables of the ./config.sh file are in
conflict with them from settings.yml:

  - PUBLIC_URL          --> {server:base_url}
  - SEARX_INTERNAL_HTTP --> {server:bind_address}.{server:port}
  - GIT_BRANCH          --> {brand:GIT_URL}

These environment variable of a SearXNG instance and additional

  - SEARX_SETTINGS_TEMPLATE

has been remove from the '.config.sh' file.  With this patch, the main focus of
./conf.sh resists on environment variables needed for the installation of morty,
filtron software.

modified  .config.sh:
  - removed no longer supported variables (see above)
  - add comment about: SearXNG setup in settings.yml

modified utils/searx.sh:
  - SEARX_INTERNAL_HTTP no longer take from .config.sh
  - SEARX_SETTINGS_PATH /etc/searx/settings.yml
  - SEARX_SETTINGS_TEMPLATE obsolete

modified utils/lib_install.sh:
  Initialize environment variables SEARX_PYENV, SEARX_SETTINGS_PATH and
  PUBLIC_URL.

modified:  utils/morty.sh
  Add missing hint about SEARX_SETTINGS_PATH and move PUBLIC_URL to
  utils/lib_install.sh

modified:  utils/morty.sh
  Move PUBLIC_URL to utils/lib_install.sh

Renamed utils/templates/etc/searx/use_default_settings.yml -> settings.yml
  - removed option which can't be modified after installation
  - add some comments with examples

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2021-07-21 14:38:57 +02:00

2 KiB

Administration API

Get configuration data

GET /config  HTTP/1.1

Sample response

{
  "autocomplete": "",
  "categories": [
    "map",
    "it",
    "images",
  ],
  "default_locale": "",
  "default_theme": "oscar",
  "engines": [
    {
      "categories": [
        "map"
      ],
      "enabled": true,
      "name": "openstreetmap",
      "shortcut": "osm"
    },
    {
      "categories": [
        "it"
      ],
      "enabled": true,
      "name": "arch linux wiki",
      "shortcut": "al"
    },
    {
      "categories": [
        "images"
      ],
      "enabled": true,
      "name": "google images",
      "shortcut": "goi"
    },
    {
      "categories": [
        "it"
      ],
      "enabled": false,
      "name": "bitbucket",
      "shortcut": "bb"
    },
  ],
  "instance_name": "searx",
  "locales": {
    "de": "Deutsch (German)",
    "en": "English",
    "eo": "Esperanto (Esperanto)",
  },
  "plugins": [
    {
      "enabled": true,
      "name": "HTTPS rewrite"
    },
    {
      "enabled": false,
      "name": "Vim-like hotkeys"
    }
  ],
  "safe_search": 0
}

The search bar can be embedded into websites. Just paste the example into the HTML of the site. URL of the searx instance and values are customizable.

<form method="post" action="https://example.org/">
  <!-- search      --> <input type="text" name="q" />
  <!-- categories  --> <input type="hidden" name="categories" value="general,social media" />
  <!-- language    --> <input type="hidden" name="lang" value="all" />
  <!-- locale      --> <input type="hidden" name="locale" value="en" />
  <!-- date filter --> <input type="hidden" name="time_range" value="month" />
</form>