From 32095c85ed5672e9b7b1cb2f78fa482ce27f0db1 Mon Sep 17 00:00:00 2001 From: Shrikant Sharat Kandula Date: Wed, 22 Jul 2020 17:23:49 +0530 Subject: [PATCH] Use single `sed` command with multiple expressions (#127) Processing the text in-memory, we won't have to deal with the platform dependency of the `-i` argument to `sed`. --- deploy/template/nginx_app.conf.sh | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/deploy/template/nginx_app.conf.sh b/deploy/template/nginx_app.conf.sh index 51c4f81010..69797eed02 100644 --- a/deploy/template/nginx_app.conf.sh +++ b/deploy/template/nginx_app.conf.sh @@ -9,7 +9,7 @@ fi # Hence we wish to prevent environment substitution here. # Relevant variables will be replaced at the end of this file via sed command -echo ' +content=' server { listen 80; $NGINX_SSL_CMNT server_name $custom_domain ; @@ -115,12 +115,8 @@ $NGINX_SSL_CMNT proxy_pass http://appsmith-internal-server:8080; $NGINX_SSL_CMNT } $NGINX_SSL_CMNT $NGINX_SSL_CMNT } -' >| nginx_app.conf +' -if [[ "$OSTYPE" == "darwin"* ]]; then - sed -i '' "s/\$NGINX_SSL_CMNT/$NGINX_SSL_CMNT/g" nginx_app.conf - sed -i '' "s/\$custom_domain/$custom_domain/g" nginx_app.conf -else - sed -i "s/\$NGINX_SSL_CMNT/$NGINX_SSL_CMNT/g" nginx_app.conf - sed -i "s/\$custom_domain/$custom_domain/g" nginx_app.conf -fi +echo "$content" \ + | sed -e "s/\$NGINX_SSL_CMNT/$NGINX_SSL_CMNT/g" -e "s/\$custom_domain/$custom_domain/g" \ + >| nginx_app.conf