Skip to content

Commit bdfcc44

Browse files
committed
feat: added db configs
1 parent bdaf029 commit bdfcc44

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

imageroot/actions/configure-module/20configure

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,22 @@ if os.path.exists("n8n.env"):
2323
auth_token = secrets.token_urlsafe(32)
2424
else:
2525
auth_token = secrets.token_urlsafe(32)
26+
27+
28+
if not os.path.exists("n8n-db.env"):
29+
if os.path.exists("database.env"):
30+
db = agent.read_envfile("database.env")
31+
random_key = secrets.token_hex(16)
32+
n8n_config = {
33+
"N8N_ENCRYPTION_KEY": random_key,
34+
"DB_TYPE": "postgresdb",
35+
"DB_POSTGRESDB_HOST": "n8n-pgsql",
36+
"DB_POSTGRESDB_PORT": "5432",
37+
"DB_POSTGRESDB_DATABASE": db.get("POSTGRES_DATABASE"),
38+
"DB_POSTGRESDB_USER": db.get("POSTGRES_NON_ROOT_USER"),
39+
"DB_POSTGRESDB_PASSWORD": db.get("POSTGRES_NON_ROOT_PASSWORD"),
40+
}
41+
agent.write_envfile("n8n-db.env", n8n_config)
2642
# n8n CSRF settings
2743
host = data.get("host", "")
2844
timezone = data.get("timezone", "UTC")

0 commit comments

Comments
 (0)