Skip to content

Commit 4d88fcc

Browse files
committed
Renamed mysql env variables
1 parent 239c015 commit 4d88fcc

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

layersbox

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -439,12 +439,12 @@ def box_install(args):
439439
db_exists = False
440440
with open(join(servicedir, service_name, env_file)) as infile:
441441
for line in infile:
442-
if "_MYSQL_NAME" in line:
443-
db_key = line.split("_MYSQL_NAME=")[0]
442+
if "_DB_NAME" in line:
443+
db_key = line.split("_DB_NAME=")[0]
444444
db_name = line.split("=")[1]
445-
elif "_MYSQL_USERNAME" in line:
445+
elif "_DB_USER" in line:
446446
db_username = line.split("=")[1]
447-
elif "_MYSQL_FILE" in line:
447+
elif "_DB_FILE" in line:
448448
db_file = line.split("=")[1].replace('\n', '')
449449
db_exists = True
450450
shutil.copyfile(join(servicedir, service_name, db_file), join(dir, "tmp", "sqlfile", "db.sql"))
@@ -458,10 +458,11 @@ def box_install(args):
458458

459459
# generate database and parse output
460460
mysqlcreate_output = subprocess.check_output(["docker-compose", "run", "mysqlcreate"])
461+
print(mysqlcreate_output)
461462
db_password = mysqlcreate_output.split(" -p")[1].split(" -hmysql")[0]
462463
# write password to env file
463464
with open(join(servicedir, service_name, env_file), "a") as outfile:
464-
outfile.write("{}_MYSQL_PASSWORD={}".format(db_key, db_password))
465+
outfile.write("{}_DB_PASSWORD={}".format(db_key, db_password))
465466

466467
# clean up and delete secret.env content, otherwise db is created again
467468
with open(join(dir, "tmp", "secret.env"), "w"):

0 commit comments

Comments
 (0)