Skip to content

Commit b68d311

Browse files
committed
feat: updated migration of vars
1 parent 3ad16dd commit b68d311

2 files changed

Lines changed: 19 additions & 2 deletions

File tree

imageroot/actions/create-module/10configure_vars

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ maria_db = {
3939
app = {
4040
"DB_HOST": "mariadb-app",
4141
"DB_PORT": "3306",
42-
"DB_USER": MARIADB_USER,
43-
"DB_PASS": MARIADB_PASSWORD,
42+
"DB_USERNAME": MARIADB_USER,
43+
"DB_PASSWORD": MARIADB_PASSWORD,
4444
"DB_DATABASE": MARIADB_DATABASE,
4545
"APP_KEY": generate_random_password(64),
4646
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env python3
2+
3+
#
4+
# Copyright (C) 2022 Nethesis S.r.l.
5+
# SPDX-License-Identifier: GPL-3.0-or-later
6+
#
7+
8+
import os
9+
import agent
10+
11+
if os.path.exists("app-db.env"):
12+
dt = agent.read_envfile("app-db.env")
13+
if "DB_USERNAME" not in dt and "DB_USER" in dt:
14+
dt["DB_USERNAME"] = dt.pop("DB_USER")
15+
if "DB_PASSWORD" not in dt and "DB_PASS" in dt:
16+
dt["DB_PASSWORD"] = dt.pop("DB_PASS")
17+
agent.write_envfile("app-db.env", dt)

0 commit comments

Comments
 (0)