Skip to content

Commit

Permalink
Add support for Atlas
Browse files Browse the repository at this point in the history
  • Loading branch information
mkrle committed Oct 12, 2023
1 parent 884616f commit fa7d9ea
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions readme-vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ param_env_vars:
- { env_var: "MONGO_PORT", env_value: "27017", desc: "Mongodb Port. Only evaluated on first run." }
- { env_var: "MONGO_DBNAME", env_value: "unifi", desc: "Mongodb Database Name (stats DB is automatically suffixed with `_stat`). Only evaluated on first run." }
- { env_var: "MONGO_TLS", env_value: "true", desc: "Mongodb enable TLS. Only evaluated on first run." }
- { env_var: "MONGO_AUTHSOURCE", env_value: "admin", desc: "Mongodb authSource. For Atlas set to `admin`.Defaults to `MONGO_DBNAME`.Only evaluated on first run." }

# optional container parameters
opt_param_usage_include_env: true
Expand Down
4 changes: 2 additions & 2 deletions root/defaults/system.properties
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@
# unifi.throughput.port=6789
#
db.mongo.local=false
db.mongo.uri=mongodb://~MONGO_USER~:~MONGO_PASS~@~MONGO_HOST~:~MONGO_PORT~/~MONGO_DBNAME~?tls=~MONGO_TLS~
statdb.mongo.uri=mongodb://~MONGO_USER~:~MONGO_PASS~@~MONGO_HOST~:~MONGO_PORT~/~MONGO_DBNAME~_stat?tls=~MONGO_TLS~
db.mongo.uri=mongodb://~MONGO_USER~:~MONGO_PASS~@~MONGO_HOST~:~MONGO_PORT~/~MONGO_DBNAME~?tls=~MONGO_TLS~&authSource=~MONGO_AUTHSOURCE~
statdb.mongo.uri=mongodb://~MONGO_USER~:~MONGO_PASS~@~MONGO_HOST~:~MONGO_PORT~/~MONGO_DBNAME~_stat?tls=~MONGO_TLS~&authSource=~MONGO_AUTHSOURCE~
unifi.db.name=~MONGO_DBNAME~
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ if [[ ! -e /config/data/system.properties ]]; then
else
sed -i "s/~MONGO_TLS~/false/" /defaults/system.properties
fi
if [[ -z "${MONGO_AUTHSOURCE}" ]]; then
sed -i "s/~MONGO_AUTHSOURCE~/${MONGO_DBNAME}/" /defaults/system.properties
else
sed -i "s/~MONGO_AUTHSOURCE~/${MONGO_AUTHSOURCE}/" /defaults/system.properties
fi
cp /defaults/system.properties /config/data
fi
fi
Expand Down

0 comments on commit fa7d9ea

Please sign in to comment.