From ce4882816b1283d324be43bea67cd0f954695f1e Mon Sep 17 00:00:00 2001 From: Thomas Hintz Date: Sat, 11 Jul 2026 14:37:43 -0700 Subject: [PATCH] Properly escape apps.config --- src/nassella.scm | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/nassella.scm b/src/nassella.scm index 57e7101..d540be1 100644 --- a/src/nassella.scm +++ b/src/nassella.scm @@ -821,9 +821,19 @@ h1, h2, h3, h4, h5, h6 { (volume-destroy . ,(search "volume_attachment.machine: Destruction complete" "volume_attachment.machine: Destroying..." "XXX - nothing")))) (define (write-config-entry name value) + (display name) + (display "='") + (display (if value + (string-translate* (->string value) '(("'" . "\\'"))) ;; escape any single quotes + ""))+ + (print "'")) + +(define (write-terraform-config-entry name value) (display name) (display "=\"") - (display value) + (display (if value + (string-translate* (->string value) '(("\"" . "\\\""))) ;; escape any double quotes + ""))+ (print "\"")) (define (progress-status->text status) @@ -1632,7 +1642,7 @@ chmod -R 777 /opt/keys"))) (with-output-to-file (string-append dir "/config/production.tfvars") (lambda () (map (lambda (e) - (write-config-entry (car e) (cdr e))) + (write-terraform-config-entry (car e) (cdr e))) `(("server_type" . ,(alist-ref 'digitalocean-size service-config)) ("do_token" . ,(alist-ref 'digitalocean-api-token service-config)) ("digitalocean_volume_size" . ,(alist-ref 'digitalocean-volume-size service-config))