From 231046cbc07ffcc247cf0706cd8186b69820881d Mon Sep 17 00:00:00 2001 From: Patrick Mulligan Date: Sun, 11 Jan 2026 20:13:55 +0100 Subject: [PATCH] Fix Nix string escaping in PostgreSQL password setup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In Nix '' strings, '''' produces a literal ''. The sed pattern to double single quotes needs this escaping. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- modules/lamassu-lnbits.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/lamassu-lnbits.nix b/modules/lamassu-lnbits.nix index b1c72bb..84b58a2 100644 --- a/modules/lamassu-lnbits.nix +++ b/modules/lamassu-lnbits.nix @@ -254,7 +254,7 @@ in if ${pkgs.postgresql}/bin/psql -tAc "SELECT 1 FROM pg_roles WHERE rolname='${cfg.database.user}'" | grep -q 1; then password=$(cat ${secretsDir}/lamassu-db-password) # Escape single quotes by doubling them (SQL standard) - escaped_password=$(printf '%s' "$password" | sed "s/'/''/g") + escaped_password=$(printf '%s' "$password" | sed "s/'/''''/g") ${pkgs.postgresql}/bin/psql -c "ALTER USER \"${cfg.database.user}\" WITH PASSWORD '$escaped_password';" exit 0 fi