From 14b9a875664c22f51309b5035cda3a9755da09dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?william=20chang=28=E5=BC=B5=E4=BB=B2=E5=A8=81=29?= Date: Tue, 21 May 2024 13:03:18 +0800 Subject: [PATCH] fix(wren-launcher): fix adding properties to config.properties (#285) --- docker/bootstrap/init.sh | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/docker/bootstrap/init.sh b/docker/bootstrap/init.sh index 40272aa95..b03c2b7ad 100644 --- a/docker/bootstrap/init.sh +++ b/docker/bootstrap/init.sh @@ -17,18 +17,27 @@ pg_username=$PG_USERNAME # touch a empty config.properties if not exists # put a content into config.properties if not exists if [ ! -f ${data_path}/config.properties ]; then - echo "node.environment=production" > ${data_path}/config.properties - echo "wren.experimental-enable-dynamic-fields=true" > ${data_path}/config.properties -# echo "PG_DATABASE=\"tpch\"" >> ${data_path}/config.properties + echo "init config.properties" + echo "node.environment=production" > ${data_path}/config.properties +fi + +# after the config.properties is created, check if config properties properly set +# if not, then append default values to the config.properties +# check if wren.experimental-enable-dynamic-fields is set, otherwise append it with true +if ! grep -q "wren.experimental-enable-dynamic-fields" ${data_path}/config.properties; then + echo "wren.experimental-enable-dynamic-fields is not set, set it to true" + echo "wren.experimental-enable-dynamic-fields=true" >> ${data_path}/config.properties fi # create a folder mdl if not exists if [ ! -d ${data_path}/mdl ]; then + echo "create mdl folder" mkdir ${data_path}/mdl fi # put a emtpy sample.json if not exists if [ ! -f ${data_path}/mdl/sample.json ]; then + echo "init mdl/sample.json" echo "{\"catalog\": \"test_catalog\", \"schema\": \"test_schema\", \"models\": []}" > ${data_path}/mdl/sample.json fi @@ -36,5 +45,6 @@ fi # accounts is a file contains the authentication information # the format is like: `username password` per line if [ ! -f ${data_path}/accounts ]; then + echo "init accounts file" echo "${pg_username} ${pg_password}" > ${data_path}/accounts fi