mirror of
https://github.com/ZettaIO/restic-compose-backup.git
synced 2025-12-16 10:41:08 +00:00
optionally accept root password for mariadb and mysql
This commit is contained in:
@@ -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",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user