Skip to content

Commit

Permalink
Improve database parameter logging
Browse files Browse the repository at this point in the history
  • Loading branch information
GJFR committed Feb 10, 2024
1 parent f4eef0e commit 1fae425
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 3 additions & 2 deletions bci/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,14 @@ def get_database_connection_params() -> DatabaseConnectionParameters:
logger.info('Could not find database environment variables, using database container...')
return container.run()
else:
logger.info(f'Found database environment variables for connection to \'{os.getenv("BCI_MONGO_HOST")}\'')
return DatabaseConnectionParameters(
database_params = DatabaseConnectionParameters(
os.getenv('BCI_MONGO_HOST'),
os.getenv('BCI_MONGO_USERNAME'),
os.getenv('BCI_MONGO_PASSWORD'),
os.getenv('BCI_MONGO_DATABASE')
)
logger.info(f'Found database environment variables \'{database_params}\'')
return database_params


class Chromium:
Expand Down
3 changes: 3 additions & 0 deletions bci/evaluations/logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ def from_dict(data: dict) -> DatabaseConnectionParameters:
data['database_name']
)

def __str__(self) -> str:
return f'{self.username}@{self.host}:27017/{self.database_name}'


@dataclass(frozen=True)
class WorkerParameters:
Expand Down

0 comments on commit 1fae425

Please sign in to comment.