mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-10-29 23:35:02 -04:00
Use jq with mongo.
This commit is contained in:
parent
162b372b4d
commit
51ad698213
@ -1,29 +0,0 @@
|
||||
# How to create a docker image for meshcentral
|
||||
|
||||
```
|
||||
> git clone https://github.com/Ylianst/MeshCentral.git
|
||||
> cd MeshCentral
|
||||
|
||||
> docker build -f docker/Dockerfile --force-rm -t meshcentral .
|
||||
|
||||
# alternative, if you want to include the mongodb-tools (mongodump, ...), you can add the 'INCLUDE_MONGODBTOOLS=yes' build argument
|
||||
> docker build -f docker/Dockerfile --force-rm --build-arg INCLUDE_MONGODBTOOLS=yes -t meshcentral .
|
||||
|
||||
# (optional) cleanup after docker build:
|
||||
> cd ..
|
||||
> rm -rf MeshCentral/
|
||||
```
|
||||
|
||||
> | Argument | Description |
|
||||
> | :--- | :--- |
|
||||
> | -f docker/Dockerfile | Path/Name of the Dockerfile |
|
||||
> | --force-rm | Always remove intermediate containers |
|
||||
> | -t meshcentral | Name and optionally a tag in the 'name:tag' format |
|
||||
|
||||
### Optional build arguments
|
||||
> | Argument | Description |
|
||||
> | :--- | :--- |
|
||||
> | INCLUDE_MONGODBTOOLS=yes | Includes mongodb-tools (mongodump, ...) in the image |
|
||||
> | DISABLE_MINIFY=yes | Disables the minification of files |
|
||||
> | DISABLE_TRANSLATE=yes | Disables the translation of files |
|
||||
|
||||
@ -35,9 +35,11 @@ if [[ "$DYNAMIC_CONFIG" =~ ^(true|yes)$ ]]; then
|
||||
MONGO_URL="${MONGO_URL:-$MONGO_USERNAME:$MONGO_PASS@}$MONGO_HOST:$MONGO_PORT"
|
||||
fi
|
||||
|
||||
ESCAPED_MONGO_URL=$(echo "$MONGO_URL" | sed 's/[\/&?=:]/\\&/g')
|
||||
#ESCAPED_MONGO_URL=$(echo "$MONGO_URL" | sed 's/[\/&?=:]/\\&/g')
|
||||
sed -i 's/"_mongoDb"/"mongoDb"/' "$CONFIG_FILE"
|
||||
sed -i "s/\"mongoDb\": *\"[^\"]*\"/\"mongoDb\": \"$ESCAPED_MONGO_URL\"/" "$CONFIG_FILE"
|
||||
jq --arg mongo_url "$MONGO_URL" \
|
||||
'.settings.mongoDb = $mongo_url' \
|
||||
"$CONFIG_FILE" > temp_config.json && mv temp_config.json "$CONFIG_FILE"
|
||||
else
|
||||
echo "Disabling MongoDB-connector..."
|
||||
sed -i 's/"mongoDb"/"_mongoDb"/' "$CONFIG_FILE"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user