-sed -i "s|url:.*|url: jdbc:postgresql://$URL_JDBC/$DB_NAME|" "$main_path/conf/engine-d.yml"
-sed -i "s|user:.*|user: $JDBC_USERNAME|" "$main_path/conf/engine-d.yml"
-sed -i "s|password:.*|password: $JDBC_PASSWORD|" "$main_path/conf/engine-d.yml"
+# if deployed using helm, use the helm-generated configuration file.
+if [ -d /opt/hemconfig ]; then
+ cp /opt/hemconfig/engine-d.yml "$main_path/conf/engine-d.yml"
+else
+ sed -i "s|url:.*|url: jdbc:postgresql://$URL_JDBC/$DB_NAME|" "$main_path/conf/engine-d.yml"
+ sed -i "s|user:.*|user: $JDBC_USERNAME|" "$main_path/conf/engine-d.yml"
+ sed -i "s|password:.*|password: $JDBC_PASSWORD|" "$main_path/conf/engine-d.yml"
+fi