mirror of
https://github.com/frappe/frappe_docker.git
synced 2024-12-23 10:38:58 +00:00
Merge pull request #356 from sahil28297/patch-1
This commit is contained in:
commit
c104d027f9
@ -19,14 +19,16 @@ def main():
|
||||
db_port = config.get('db_port', 3306)
|
||||
db_host = config.get('db_host')
|
||||
site_name = os.environ.get("SITE_NAME", 'site1.localhost')
|
||||
mariadb_root_username = os.environ.get("DB_ROOT_USER", 'root')
|
||||
db_root_username = os.environ.get("DB_ROOT_USER", 'root')
|
||||
mariadb_root_password = get_password("MYSQL_ROOT_PASSWORD", 'admin')
|
||||
postgres_root_password = get_password("POSTGRES_PASSWORD")
|
||||
db_root_password = mariadb_root_password
|
||||
|
||||
if postgres_root_password:
|
||||
db_type = 'postgres'
|
||||
db_host = os.environ.get("POSTGRES_HOST")
|
||||
db_port = 5432
|
||||
db_root_password = postgres_root_password
|
||||
if not db_host:
|
||||
db_host = config.get('db_host')
|
||||
print('Environment variable POSTGRES_HOST not found.')
|
||||
@ -34,8 +36,8 @@ def main():
|
||||
|
||||
sites_path = os.getcwd()
|
||||
common_site_config_path = os.path.join(sites_path, COMMON_SITE_CONFIG_FILE)
|
||||
update_site_config("root_login", mariadb_root_username, validate = False, site_config_path = common_site_config_path)
|
||||
update_site_config("root_password", postgres_root_password, validate = False, site_config_path = common_site_config_path)
|
||||
update_site_config("root_login", db_root_username, validate = False, site_config_path = common_site_config_path)
|
||||
update_site_config("root_password", db_root_password, validate = False, site_config_path = common_site_config_path)
|
||||
|
||||
force = True if os.environ.get("FORCE", None) else False
|
||||
install_apps = os.environ.get("INSTALL_APPS", None)
|
||||
@ -46,8 +48,8 @@ def main():
|
||||
_new_site(
|
||||
None,
|
||||
site_name,
|
||||
mariadb_root_username=mariadb_root_username,
|
||||
mariadb_root_password=mariadb_root_password,
|
||||
mariadb_root_username=db_root_username,
|
||||
mariadb_root_password=db_root_password,
|
||||
admin_password=get_password("ADMIN_PASSWORD", 'admin'),
|
||||
verbose=True,
|
||||
install_apps=install_apps,
|
||||
@ -62,8 +64,8 @@ def main():
|
||||
_new_site(
|
||||
None,
|
||||
site_name,
|
||||
mariadb_root_username=mariadb_root_username,
|
||||
mariadb_root_password=mariadb_root_password,
|
||||
mariadb_root_username=db_root_username,
|
||||
mariadb_root_password=db_root_password,
|
||||
admin_password=get_password("ADMIN_PASSWORD", 'admin'),
|
||||
verbose=True,
|
||||
install_apps=install_apps,
|
||||
@ -78,7 +80,7 @@ def main():
|
||||
db_name = site_config.get('db_name')
|
||||
db_password = site_config.get('db_password')
|
||||
|
||||
mysql_command = ["mysql", f"-h{db_host}", f"-u{mariadb_root_username}", f"-p{mariadb_root_password}", "-e"]
|
||||
mysql_command = ["mysql", f"-h{db_host}", f"-u{db_root_username}", f"-p{mariadb_root_password}", "-e"]
|
||||
|
||||
# Drop User if exists
|
||||
command = mysql_command + [f"DROP USER IF EXISTS '{db_name}'@'%'; FLUSH PRIVILEGES;"]
|
||||
|
Loading…
Reference in New Issue
Block a user