This is an automated email from the ASF dual-hosted git repository.

monkeydluffy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-docker.git


The following commit(s) were added to refs/heads/master by this push:
     new a01780a  fix: sed not suitable for docker if config.yaml is volume 
mounted (#534)
a01780a is described below

commit a01780aa972706dfb3c56e1142c08cbcca1662b2
Author: inceptio-jingzhao <[email protected]>
AuthorDate: Fri Jan 12 11:37:11 2024 +0800

    fix: sed not suitable for docker if config.yaml is volume mounted (#534)
---
 debian-dev/docker-entrypoint.sh | 7 ++++---
 debian/docker-entrypoint.sh     | 6 +++---
 redhat/docker-entrypoint.sh     | 6 +++---
 3 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/debian-dev/docker-entrypoint.sh b/debian-dev/docker-entrypoint.sh
index 1fe8c44..f718502 100755
--- a/debian-dev/docker-entrypoint.sh
+++ b/debian-dev/docker-entrypoint.sh
@@ -32,9 +32,10 @@ deployment:
 _EOC_
       else
           # updating config.yaml for standalone mode
-          sed -i 's/role: traditional/role: data_plane/' 
${PREFIX}/conf/config.yaml
-          sed -i 's/role_traditional:/role_data_plane:/' 
${PREFIX}/conf/config.yaml
-          sed -i 's/config_provider: etcd/config_provider: yaml/' 
${PREFIX}/conf/config.yaml
+          echo "$(sed 's/role: traditional/role: data_plane/g' 
${PREFIX}/conf/config.yaml)" > ${PREFIX}/conf/config.yaml
+          echo "$(sed 's/role_traditional:/role_data_plane:/g' 
${PREFIX}/conf/config.yaml)" > ${PREFIX}/conf/config.yaml
+          echo "$(sed 's/config_provider: etcd/config_provider: yaml/g' 
${PREFIX}/conf/config.yaml)" > ${PREFIX}/conf/config.yaml
+
       fi
 
         if [ ! -f "${PREFIX}/conf/apisix.yaml" ]; then
diff --git a/debian/docker-entrypoint.sh b/debian/docker-entrypoint.sh
index a8a34a9..04fe00b 100755
--- a/debian/docker-entrypoint.sh
+++ b/debian/docker-entrypoint.sh
@@ -32,9 +32,9 @@ deployment:
 _EOC_
       else
           # updating config.yaml for standalone mode
-          sed -i 's/role: traditional/role: data_plane/' 
${PREFIX}/conf/config.yaml
-          sed -i 's/role_traditional:/role_data_plane:/' 
${PREFIX}/conf/config.yaml
-          sed -i 's/config_provider: etcd/config_provider: yaml/' 
${PREFIX}/conf/config.yaml
+          echo "$(sed 's/role: traditional/role: data_plane/g' 
${PREFIX}/conf/config.yaml)" > ${PREFIX}/conf/config.yaml
+          echo "$(sed 's/role_traditional:/role_data_plane:/g' 
${PREFIX}/conf/config.yaml)" > ${PREFIX}/conf/config.yaml
+          echo "$(sed 's/config_provider: etcd/config_provider: yaml/g' 
${PREFIX}/conf/config.yaml)" > ${PREFIX}/conf/config.yaml
       fi
 
         if [ ! -f "${PREFIX}/conf/apisix.yaml" ]; then
diff --git a/redhat/docker-entrypoint.sh b/redhat/docker-entrypoint.sh
index a8a34a9..04fe00b 100755
--- a/redhat/docker-entrypoint.sh
+++ b/redhat/docker-entrypoint.sh
@@ -32,9 +32,9 @@ deployment:
 _EOC_
       else
           # updating config.yaml for standalone mode
-          sed -i 's/role: traditional/role: data_plane/' 
${PREFIX}/conf/config.yaml
-          sed -i 's/role_traditional:/role_data_plane:/' 
${PREFIX}/conf/config.yaml
-          sed -i 's/config_provider: etcd/config_provider: yaml/' 
${PREFIX}/conf/config.yaml
+          echo "$(sed 's/role: traditional/role: data_plane/g' 
${PREFIX}/conf/config.yaml)" > ${PREFIX}/conf/config.yaml
+          echo "$(sed 's/role_traditional:/role_data_plane:/g' 
${PREFIX}/conf/config.yaml)" > ${PREFIX}/conf/config.yaml
+          echo "$(sed 's/config_provider: etcd/config_provider: yaml/g' 
${PREFIX}/conf/config.yaml)" > ${PREFIX}/conf/config.yaml
       fi
 
         if [ ! -f "${PREFIX}/conf/apisix.yaml" ]; then

Reply via email to