Skip to content

Feature request: support loading FILTER_REGEX from a file path #2062

Description

@fdefilippo

Describe the problem

Currently, FILTER_REGEX can only be set via environment variable. For long or frequently updated blacklists, this is inconvenient:

  • Environment variables have length limits on some systems
  • Updating the filter requires restarting the container with a modified compose file
  • There's no easy way to manage the list outside the deployment config
  • Long regex patterns clutter docker-compose.yml / systemd unit files

Describe the solution you'd like

Allow FILTER_REGEX to accept either:

  1. A raw regex string (as it does now) — for simple, static filters
  2. A file path prefix, e.g. /etc/remark42/filter.txt — the engine reads the regex pattern from the file

Suggestion: if the value starts with / or ./, treat it as a file path. Otherwise treat it as a regex string.

Alternative

Add a separate env var like FILTER_REGEX_FILE=/path/to/filter.txt that takes priority over FILTER_REGEX when set.

Use case example

# In docker-compose.yml (clean):
- FILTER_REGEX_FILE=/etc/remark42/blacklist.txt

# On the host (/etc/remark42/blacklist.txt):
\b(cazzo|merda|puttana|spam|viagra)\b|https?://\S*(?:casino|poker)\S*

This way the docker-compose.yml stays clean and the blacklist can be updated without touching the deployment config.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions