Skip to content

Commit

Permalink
more fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
silvae86 committed Jun 1, 2020
1 parent 1739ed5 commit 54a56f3
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
5 changes: 4 additions & 1 deletion conf/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,10 @@ fi

## wait for servers to be active before running the application

./conf/wait-for-it.sh "$NEO4J_HOST:$NEO4J_PORT" --timeout=120
./conf/wait-for-it.sh "$NEO4J_HOST:$NEO4J_PORT" --timeout=120 &
./conf/wait-for-it.sh "$MONGODB_HOST:$MONGODB_PORT" --timeout=120 &

wait

# preload graph
if [[ -z "$INIT_GRAPH" ]] ; then
Expand Down
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ services:
- "NEO4J_PORT=7687"
- "MONGODB_HOST=archgraph-mongodb"
- "MONGODB_PORT=27017"
- "MONGODB_USERNAME=root"
- "MONGODB_PASSWORD=rootpassword"
- "CUSTOM_HOST_FOR_SERVER_BIND=0.0.0.0"
- "RUN_IN_PRODUCTION=1"
- "INIT_GRAPH=1"
Expand Down
4 changes: 3 additions & 1 deletion src/Routes/mongo.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import json
from datetime import datetime
from pymongo import MongoClient, uri_parser
from pymongo import MongoClient


import src.Utils.EnvVarManager as EnvVarManager
Expand All @@ -11,6 +11,8 @@
client = MongoClient(
host=EnvVarManager.get_from_env_or_return_default("MONGODB_HOST", "localhost"),
port=int(EnvVarManager.get_from_env_or_return_default("MONGODB_PORT", "27017")),
username=EnvVarManager.get_from_env_or_return_default("MONGODB_USERNAME", "root"),
password=EnvVarManager.get_from_env_or_return_default("MONGODB_PASSWORD", "rootpassword"),
connectTimeoutMS=120000,
)
db = client.mydatabase
Expand Down
6 changes: 6 additions & 0 deletions src/Utils/EnvVarManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ def parse():
if "MONGODB_PORT" in os.environ:
args["MONGODB_PORT"] = os.environ["MONGODB_PORT"]

if "MONGODB_USERNAME" in os.environ:
args["MONGODB_USERNAME"] = os.environ["MONGODB_USERNAME"]

if "MONGODB_PASSWORD" in os.environ:
args["MONGODB_PASSWORD"] = os.environ["MONGODB_PASSWORD"]

if "CUSTOM_HOST_FOR_SERVER_BIND" in os.environ:
args["CUSTOM_HOST_FOR_SERVER_BIND"] = os.environ["CUSTOM_HOST_FOR_SERVER_BIND"]

Expand Down

0 comments on commit 54a56f3

Please sign in to comment.