Skip to content
Daniel Ramsay edited this page Mar 19, 2023 · 1 revision

Configuration

Blocking-middleware API configuration

A template configuration file is included in the blocking-middleware software distribution as api/1.2/libs/config. example.php. This file can be copied to api/1.2/libs/config.php and customized.

For docker images, a provided config.docker.php file can be copied to the same location, allowing docker environment variables and container aliases to be automatically read for inter-service operation.

Configuration options are declared as PHP variables (prefixed with $) or PHP constants (used with define()).

Configuration reference

Database connection details

  • $PG_HOST : Database hostname
  • $PG_PORT : Database port number
  • $PG_USER : Database username
  • $PG_PASS : Database password
  • $PG_DB : Database name

RabbitMQ connection details

  • $AMQP_HOST : RabbitMQ hostname

  • $AMQP_USER : RabbitMQ Username

  • $AMQP_PASS : RabbitMQ Password

  • $AMQP_VHOST : RabbitMQ vhost

  • $SUBMIT_ROUTING_KEY : Routing key for URL submissions

Elasticsearch connection details

  • $ELASTIC : http://hostname:port used for elasticsearch query & update
  • ELASTIC_ADULT_FILTER : set of high-confidence search expressions to remove adult content (in order to highlight non-adult blocks)

Frontend website names

  • SITE_EMAIL : email address used in email from the system

  • SITE_NAME : name of the frontend site

  • SITE_URL : Frontend site URL, used for links in API responses and email messages

  • FEATURE_SEND_SUBSCRIBE_EMAIL (bool) : enable mail sending for "send email updates" feature

  • CONFIRM_URL : URL used for user-verification email confirmation webpage

  • VERIFY_URL : URL used for user-verification links

Email integration

  • FEATURE_EMAIL_TRACKING (bool) : enable email-based case management
  • MAIL_DOMAIN : domain used for email-based case management

Probe configuration serving

  • CONFIG_LATEST : name of the probe configuration file to serve from the /api/1.2/config/latest API endpoint.

Supporting services

The blocking-middleware project includes some daemon processes and supporting scripts which are used to provide additional results processing or database maintenance. Some daemons are written in Python and use separate configuration files, and some are PHP scripts that use the same configuration as the API.

checker.py - robots.txt support ahead of web-based tests

metadata - save category information from HTML meta tags for tested URLs

whois-lookup - save whois information for tested URLs

categoryimporter - save category information from categorify for tested URLs

Probe configuration

The API is used to serve probe configuration files from the /api/1.2/config/latest or /api/1.2/config/<version> API endpoints.

The probe configuration file format is described [here](https://wiki.openrightsgroup. org/wiki/Censorship_Monitoring_Project_API_Block_Rules_Format).

Files can be placed in api/1.2/config. A datecode-based filename is recommended (yyyymmdd.json). The api/1. 2/config/latest API endpoint will serve the file specified by the CONFIG_LATEST configuration option, or the last filename (according to alpha-numeric sorting) if the config option is not defined.