Browse Source

Allow the user to provide an API Key (#6)

Allow the user to provide a Google Maps API Key.

- The API key will be inserted into the generated `.html` file.
- Thanks to @StefanBossbaly for the contribution.
Stefan Bossbaly 7 years ago
parent
commit
db29b3057c
2 changed files with 6 additions and 0 deletions
  1. 1 0
      README.md
  2. 5 0
      entrypoint.sh

+ 1 - 0
README.md

@@ -14,6 +14,7 @@ The goal of this image is to easily run [Minecraft Overviewer](https://overviewe
 docker run \
   --rm \
   -e MINECRAFT_VERSION=1.11.2 \
+  -e GOOGLE_MAPS_API_KEY=<Google Maps API Key>
   -v /home/user/minecraft/:/home/minecraft/server/:ro \
   -v /srv/http/minecraft/:/home/minecraft/render/:rw \
   mide/minecraft-overviewer:latest

+ 5 - 0
entrypoint.sh

@@ -13,3 +13,8 @@ wget -N https://s3.amazonaws.com/Minecraft.Download/versions/${MINECRAFT_VERSION
 # Run the world renders (One pass to make map, one to generate points of interests)
 overviewer.py --config /home/minecraft/config.py
 overviewer.py --config /home/minecraft/config.py --genpoi
+
+# Add Google Maps API key if the GOOGLE_MAPS_API_KEY environment variable is set
+if [ "$GOOGLE_MAPS_API_KEY" ]; then
+  sed -i "s|https://maps.google.com/maps/api/js|&?key=${GOOGLE_MAPS_API_KEY}|g" /home/minecraft/render/index.html
+fi