From ee9afce820d6b202f7d70d714b159e261d566a31 Mon Sep 17 00:00:00 2001
From: Tristan Sloughter <t@crashfast.com>
Date: Fri, 9 May 2014 20:03:25 -0500
Subject: add option to extended start script to replace env vars in config
 files

---
 priv/templates/extended_bin.dtl | 10 ++++++++++
 1 file changed, 10 insertions(+)

(limited to 'priv')

diff --git a/priv/templates/extended_bin.dtl b/priv/templates/extended_bin.dtl
index 807116b..0dcdd18 100644
--- a/priv/templates/extended_bin.dtl
+++ b/priv/templates/extended_bin.dtl
@@ -65,6 +65,11 @@ if [ -z "$VMARGS_PATH" ]; then
     fi
 fi
 
+if [ $RELX_REPLACE_OS_VARS ]; then
+    awk '{while(match($0,"[$]{[^}]*}")) {var=substr($0,RSTART+2,RLENGTH -3);gsub("[$]{"var"}",ENVIRON[var])}}1' < $VMARGS_PATH > $VMARGS_PATH.2.config
+    VMARGS_PATH=$VMARGS_PATH.2.config
+fi
+
 # Make sure log directory exists
 mkdir -p "$RUNNER_LOG_DIR"
 
@@ -76,6 +81,11 @@ if [ -z "$CONFIG_PATH" ]; then
     fi
 fi
 
+if [ $RELX_REPLACE_OS_VARS ]; then
+    awk '{while(match($0,"[$]{[^}]*}")) {var=substr($0,RSTART+2,RLENGTH -3);gsub("[$]{"var"}",ENVIRON[var])}}1' < $CONFIG_PATH > $CONFIG_PATH.2.config
+    CONFIG_PATH=$CONFIG_PATH.2.config
+fi
+
 # Extract the target node name from node.args
 NAME_ARG=$(egrep '^-s?name' "$VMARGS_PATH")
 if [ -z "$NAME_ARG" ]; then
-- 
cgit v1.2.3