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 4b606d1  feat: do not overwrite existing yaml files (#491)
4b606d1 is described below

commit 4b606d1b99f0d55161010bd805932c6227c2b6c4
Author: kamly <[email protected]>
AuthorDate: Fri Sep 1 00:30:00 2023 +0800

    feat: do not overwrite existing yaml files (#491)
---
 centos/docker-entrypoint.sh     | 6 +++++-
 debian-dev/docker-entrypoint.sh | 6 +++++-
 debian/docker-entrypoint.sh     | 6 +++++-
 redhat/docker-entrypoint.sh     | 6 +++++-
 4 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/centos/docker-entrypoint.sh b/centos/docker-entrypoint.sh
index 3b6802b..085c5e5 100755
--- a/centos/docker-entrypoint.sh
+++ b/centos/docker-entrypoint.sh
@@ -22,18 +22,22 @@ PREFIX=${APISIX_PREFIX:=/usr/local/apisix}
 
 if [[ "$1" == "docker-start" ]]; then
     if [ "$APISIX_STAND_ALONE" = "true" ]; then
-        cat > ${PREFIX}/conf/config.yaml << _EOC_
+      if [ ! -f "${PREFIX}/conf/config.yaml" ]; then
+          cat > ${PREFIX}/conf/config.yaml << _EOC_
 deployment:
   role: data_plane
   role_data_plane:
     config_provider: yaml
 _EOC_
+      fi
 
+      if [ ! -f "${PREFIX}/conf/apisix.yaml" ]; then
         cat > ${PREFIX}/conf/apisix.yaml << _EOC_
 routes:
   -
 #END
 _EOC_
+      fi
         /usr/bin/apisix init
     else
         /usr/bin/apisix init
diff --git a/debian-dev/docker-entrypoint.sh b/debian-dev/docker-entrypoint.sh
index e64327e..d58b26a 100755
--- a/debian-dev/docker-entrypoint.sh
+++ b/debian-dev/docker-entrypoint.sh
@@ -22,18 +22,22 @@ PREFIX=${APISIX_PREFIX:=/usr/local/apisix}
 
 if [[ "$1" == "docker-start" ]]; then
     if [ "$APISIX_STAND_ALONE" = "true" ]; then
-        cat > ${PREFIX}/conf/config.yaml << _EOC_
+      if [ ! -f "${PREFIX}/conf/config.yaml" ]; then
+          cat > ${PREFIX}/conf/config.yaml << _EOC_
 deployment:
   role: data_plane
   role_data_plane:
     config_provider: yaml
 _EOC_
+      fi
 
+      if [ ! -f "${PREFIX}/conf/apisix.yaml" ]; then
         cat > ${PREFIX}/conf/apisix.yaml << _EOC_
 routes:
   -
 #END
 _EOC_
+      fi
         /usr/bin/apisix init
     else
         /usr/bin/apisix init
diff --git a/debian/docker-entrypoint.sh b/debian/docker-entrypoint.sh
index 3b6802b..085c5e5 100755
--- a/debian/docker-entrypoint.sh
+++ b/debian/docker-entrypoint.sh
@@ -22,18 +22,22 @@ PREFIX=${APISIX_PREFIX:=/usr/local/apisix}
 
 if [[ "$1" == "docker-start" ]]; then
     if [ "$APISIX_STAND_ALONE" = "true" ]; then
-        cat > ${PREFIX}/conf/config.yaml << _EOC_
+      if [ ! -f "${PREFIX}/conf/config.yaml" ]; then
+          cat > ${PREFIX}/conf/config.yaml << _EOC_
 deployment:
   role: data_plane
   role_data_plane:
     config_provider: yaml
 _EOC_
+      fi
 
+      if [ ! -f "${PREFIX}/conf/apisix.yaml" ]; then
         cat > ${PREFIX}/conf/apisix.yaml << _EOC_
 routes:
   -
 #END
 _EOC_
+      fi
         /usr/bin/apisix init
     else
         /usr/bin/apisix init
diff --git a/redhat/docker-entrypoint.sh b/redhat/docker-entrypoint.sh
index 3b6802b..085c5e5 100755
--- a/redhat/docker-entrypoint.sh
+++ b/redhat/docker-entrypoint.sh
@@ -22,18 +22,22 @@ PREFIX=${APISIX_PREFIX:=/usr/local/apisix}
 
 if [[ "$1" == "docker-start" ]]; then
     if [ "$APISIX_STAND_ALONE" = "true" ]; then
-        cat > ${PREFIX}/conf/config.yaml << _EOC_
+      if [ ! -f "${PREFIX}/conf/config.yaml" ]; then
+          cat > ${PREFIX}/conf/config.yaml << _EOC_
 deployment:
   role: data_plane
   role_data_plane:
     config_provider: yaml
 _EOC_
+      fi
 
+      if [ ! -f "${PREFIX}/conf/apisix.yaml" ]; then
         cat > ${PREFIX}/conf/apisix.yaml << _EOC_
 routes:
   -
 #END
 _EOC_
+      fi
         /usr/bin/apisix init
     else
         /usr/bin/apisix init

Reply via email to