Skip to content

Commit b9c9a11

Browse files
author
djklim87
committed
docs: Add README notes on dynamic config and env-driven variables
1 parent 20e4cce commit b9c9a11

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,32 @@ Take into account that Manticore search inside the container is run under user `
249249
docker exec -it manticore gosu manticore indexer --all --rotate
250250
```
251251

252+
### Dynamic configuration (config as a script)
253+
254+
You can make the mounted config file dynamic by turning it into a script. If `/etc/manticoresearch/manticore.conf` starts with `#!/bin/sh` or `#!/bin/bash`, the container executes it and uses its stdout as the final config. This lets you use environment variables that you pass via `docker run -e` or docker-compose `environment:`. This can be useful for injecting sensitive values at runtime instead of hardcoding them in the file.
255+
256+
Example `manticore.conf`:
257+
```bash
258+
#!/bin/bash
259+
cat <<EOF
260+
searchd {
261+
listen = ${MYSQL_LISTEN:-9306:mysql}
262+
listen = ${HTTP_LISTEN:-9308:http}
263+
}
264+
EOF
265+
```
266+
267+
Run with:
268+
```bash
269+
docker run --name manticore \
270+
-e MYSQL_LISTEN='9307:mysql' \
271+
-e HTTP_LISTEN='9316:http' \
272+
-v $(pwd)/manticore.conf:/etc/manticoresearch/manticore.conf \
273+
-d manticoresearch/manticore
274+
```
275+
276+
Environment variable overrides like `searchd_*` and `common_*` are applied after the script output is generated.
277+
252278
You can also set individual `searchd` and `common` configuration settings using Docker environment variables.
253279

254280
The settings must be prefixed with their section name, example for in case of `mysql_version_string` the variable must be named `searchd_mysql_version_string`:

0 commit comments

Comments
 (0)