TheShubhendra commented on code in PR #558:
URL: https://github.com/apache/apisix-docker/pull/558#discussion_r1716402648


##########
redhat/docker-entrypoint.sh:
##########
@@ -31,10 +31,29 @@ deployment:
     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
+          # Check if the deployment role is set to data_plane and config 
provider is set to yaml for standalone mode

Review Comment:
   ```bash
   #!/bin/bash
   
   check_config() {
       local key="$1"
       local expected_value="$2"
       local error_message="$3"
   
       if ! grep -q "${key}: ${expected_value}" "${PREFIX}/conf/config.yaml"; 
then
           echo "Error: ${PREFIX}/conf/config.yaml does not contain '${key}: 
${expected_value}'. ${error_message}"
           echo "Please refer to the APISIX documentation for deployment modes: 
https://apisix.apache.org/docs/apisix/deployment-modes/";
           exit 1
       fi
   }
   
   check_config "role" "data_plane" "Deployment role must be set to 
'data_plane' for standalone mode."
   check_config "role_data_plane" "" "Role must be set to 'role_data_plane:' 
for standalone mode."
   check_config "config_provider" "yaml" "Config provider must be set to 'yaml' 
for standalone mode."
   ```
   This file can be placed into /utils and then sourced into all entrypoint 
files.



-- 
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]

Reply via email to