Skip to content

Commit

Permalink
fixed mongo port reading as string
Browse files Browse the repository at this point in the history
  • Loading branch information
adpham95 committed Nov 7, 2019
1 parent 4cd946d commit 0eb829c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions api/server/db/mongo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ def __init__(self):
self.async_client = motor.motor_asyncio.AsyncIOMotorClient(username=config.DB_USERNAME,
password=config.get_from_file(config.MONGO_KEY_PATH),
host=config.MONGO_HOST,
port=config.MONGO_PORT)
port=config.get_int("MONGO_PORT"))

self.reg_client = pymongo.MongoClient(username=config.DB_USERNAME,
password=config.get_from_file(config.MONGO_KEY_PATH),
host=config.MONGO_HOST,
port=config.MONGO_PORT)
port=config.get_int("MONGO_PORT"))

self.init_db()

Expand Down
4 changes: 2 additions & 2 deletions common/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,10 @@ class Config:
# DOCKER_TLS_VERIFY = os.getenv("DOCKER_TLS_VERIFY", "1")
# DOCKER_CERT_PATH = os.getenv("DOCKER_CERT_PATH", "/Path/to/certs/for/remote/docker/daemon")

def get_int(self, key, default):
def get_int(self, key, default=None):
return sint(getattr(self, key), default)

def get_float(self, key, default):
def get_float(self, key, default=None):
return sfloat(getattr(self, key), default)

def load_config(self):
Expand Down

0 comments on commit 0eb829c

Please sign in to comment.