Merge pull request #2 from linuxserver/init-order

Sed password last to avoid issues with special characters
This commit is contained in:
driz 2023-09-07 06:18:42 -05:00 committed by GitHub
commit fe3ded98af
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View file

@ -61,6 +61,8 @@ app_setup_block: |
Formally only mongodb 3.6 through 4.4 are supported, however, it has been reported that newer versions will work. If you choose to use a newer version be aware that you will not be operating a supported configuration.
**Make sure you pin your database image version and do not use `latest`, as mongodb does not support automatic upgrades between major versions.**
If you are using the [official mongodb container](https://hub.docker.com/_/mongo/), you can create your databases using an `init-mongo.js` file with the following contents:
```js

View file

@ -25,10 +25,10 @@ if [[ ! -e /config/data/system.properties ]]; then
exit 1
else
sed -i "s/~MONGO_USER~/${MONGO_USER}/" /defaults/system.properties
sed -i "s/~MONGO_PASS~/${MONGO_PASS}/" /defaults/system.properties
sed -i "s/~MONGO_HOST~/${MONGO_HOST}/" /defaults/system.properties
sed -i "s/~MONGO_PORT~/${MONGO_PORT}/" /defaults/system.properties
sed -i "s/~MONGO_DBNAME~/${MONGO_DBNAME}/" /defaults/system.properties
sed -i "s/~MONGO_PASS~/${MONGO_PASS}/" /defaults/system.properties
cp /defaults/system.properties /config/data
fi
fi