kayx23 commented on code in PR #547:
URL: https://github.com/apache/apisix-docker/pull/547#discussion_r1554816443
##########
debian-dev/docker-entrypoint.sh:
##########
@@ -21,46 +21,54 @@ set -eo pipefail
PREFIX=${APISIX_PREFIX:=/usr/local/apisix}
if [[ "$1" == "docker-start" ]]; then
- if [ "$APISIX_STAND_ALONE" = "true" ]; then
- # If the file is not present then initialise the content otherwise
update relevant keys for standalone mode
- if [ ! -f "${PREFIX}/conf/config.yaml" ]; then
- cat > ${PREFIX}/conf/config.yaml << _EOC_
+ if [ "$APISIX_STAND_ALONE" = "true" ]; then
+ # If the file is not present then initialise the content
otherwise check relevant keys for standalone mode
+ if [ ! -f "${PREFIX}/conf/config.yaml" ]; then
+ cat > ${PREFIX}/conf/config.yaml << _EOC_
deployment:
role: data_plane
role_data_plane:
- config_provider: yaml
+ config_provider: yaml
_EOC_
- else
- # updating config.yaml for standalone mode
- 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
+ else
+ # checking config.yaml has required values for
standalone mode, we don't fix the file since that causes issues with readonly
dirs in Docker
+ if ! grep -qz "role:\s*data_plane"
"${PREFIX}/conf/config.yaml"; then
+ echo "Missing 'role: data_plane' entry in
config.yaml";
+ exit 1
+ fi
+ if ! grep -qz "role_data_plane:"
"${PREFIX}/conf/config.yaml"; then
+ echo "Missing 'role_data_plane:' entry in
config.yaml";
+ exit 1
+ fi
+ if ! grep -qz "config_provider:\s*yaml"
"${PREFIX}/conf/config.yaml"; then
+ echo "Missing 'config_provider: yaml' entry in
config.yaml";
+ exit 1
+ fi
+ fi
- fi
-
- if [ ! -f "${PREFIX}/conf/apisix.yaml" ]; then
- cat > ${PREFIX}/conf/apisix.yaml << _EOC_
+ 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
- /usr/bin/apisix init_etcd
- fi
+ fi
Review Comment:
Please change the irrelevant indentation changes back for easier review.
Thanks.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]