optionally accept root password for mariadb and mysql
This commit is contained in:
parent
2cb3d3202c
commit
3e934ea108
1 changed files with 16 additions and 4 deletions
|
@ -14,10 +14,16 @@ class MariadbContainer(Container):
|
||||||
|
|
||||||
def get_credentials(self) -> dict:
|
def get_credentials(self) -> dict:
|
||||||
"""dict: get credentials for the service"""
|
"""dict: get credentials for the service"""
|
||||||
|
password = self.get_config_env('MARIADB_ROOT_PASSWORD')
|
||||||
|
if root_password is not None:
|
||||||
|
username = "root"
|
||||||
|
else:
|
||||||
|
username = self.get_config_env('MARIADB_USER')
|
||||||
|
password = self.get_config_env('MARIADB_PASSWORD')
|
||||||
return {
|
return {
|
||||||
'host': self.hostname,
|
'host': self.hostname,
|
||||||
'username': self.get_config_env('MARIADB_USER'),
|
'username': username,
|
||||||
'password': self.get_config_env('MARIADB_PASSWORD'),
|
'password': password,
|
||||||
'port': "3306",
|
'port': "3306",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,10 +80,16 @@ class MysqlContainer(Container):
|
||||||
|
|
||||||
def get_credentials(self) -> dict:
|
def get_credentials(self) -> dict:
|
||||||
"""dict: get credentials for the service"""
|
"""dict: get credentials for the service"""
|
||||||
|
password = self.get_config_env('MYSQL_ROOT_PASSWORD')
|
||||||
|
if root_password is not None:
|
||||||
|
username = "root"
|
||||||
|
else:
|
||||||
|
username = self.get_config_env('MYSQL_USER')
|
||||||
|
password = self.get_config_env('MYSQL_PASSWORD')
|
||||||
return {
|
return {
|
||||||
'host': self.hostname,
|
'host': self.hostname,
|
||||||
'username': self.get_config_env('MYSQL_USER'),
|
'username': username,
|
||||||
'password': self.get_config_env('MYSQL_PASSWORD'),
|
'password': password,
|
||||||
'port': "3306",
|
'port': "3306",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue