Skip to content

Commit

Permalink
Merge pull request #245 from RubenRibGarcia/rrg/configurable-mongodb-…
Browse files Browse the repository at this point in the history
…exposed-port

Configurable MongoDB exposed port
  • Loading branch information
tillahoffmann committed Sep 13, 2022
2 parents b65c8a0 + f89ca98 commit f451476
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions testcontainers/mongodb.py
Expand Up @@ -50,10 +50,13 @@ class MongoDbContainer(DbContainer):
MONGO_INITDB_ROOT_PASSWORD = os.environ.get("MONGO_INITDB_ROOT_PASSWORD", "test")
MONGO_DB = os.environ.get("MONGO_DB", "test")

def __init__(self, image="mongo:latest", **kwargs):
def __init__(self,
image: str = "mongo:latest",
port_to_expose: int = 27017,
**kwargs):
super(MongoDbContainer, self).__init__(image=image, **kwargs)
self.command = "mongo"
self.port_to_expose = 27017
self.port_to_expose = port_to_expose
self.with_exposed_ports(self.port_to_expose)

def _configure(self):
Expand Down

0 comments on commit f451476

Please sign in to comment.