janiussyafiq commented on code in PR #12949:
URL: https://github.com/apache/apisix/pull/12949#discussion_r2742476358


##########
docker/utils/check_standalone_config.sh:
##########
@@ -16,20 +16,30 @@
 # limitations under the License.
 #
 
-if ! grep -q 'role: data_plane' "${PREFIX}/conf/config.yaml"; then
-    echo "Error: ${PREFIX}/conf/config.yaml does not contain 'role: 
data_plane'. Deployment role must be set to 'data_plane' for standalone mode."
+CONF_FILE="${PREFIX}/conf/config.yaml"
+if [ -n "$APISIX_PROFILE" ]; then
+    CONF_FILE="${PREFIX}/conf/config-${APISIX_PROFILE}.yaml"
+fi
+
+if [ ! -f "$CONF_FILE" ]; then
+    echo "Error: Configuration file not found: $CONF_FILE"
+    exit 1
+fi
+
+if ! grep -E -q '["'\'']?role["'\'']?:\s*["'\'']?data_plane["'\'']?' 
"$CONF_FILE"; then
+    echo "Error: $CONF_FILE does not contain 'role: data_plane'. Deployment 
role must be set to 'data_plane' for standalone mode."
     echo "Please refer to the APISIX documentation for deployment modes: 
https://apisix.apache.org/docs/apisix/deployment-modes/";
     exit 1
 fi
 
-if ! grep -q 'role_data_plane:' "${PREFIX}/conf/config.yaml"; then
-    echo "Error: ${PREFIX}/conf/config.yaml does not contain 
'role_data_plane:'."
+if ! grep -E -q '["'\'']?role_data_plane["'\'']?:' "$CONF_FILE"; then
+    echo "Error: $CONF_FILE does not contain 'role_data_plane:'."
     echo "Please refer to the APISIX documentation for deployment modes: 
https://apisix.apache.org/docs/apisix/deployment-modes/";
     exit 1
 fi
 
-if ! grep -q 'config_provider: yaml' "${PREFIX}/conf/config.yaml"; then
-    echo "Error: ${PREFIX}/conf/config.yaml does not contain 'config_provider: 
yaml'. Config provider must be set to 'yaml' for standalone mode."
+if ! grep -E -q '["'\'']?config_provider["'\'']?:\s*["'\'']?yaml["'\'']?' 
"$CONF_FILE"; then
+    echo "Error: $CONF_FILE does not contain 'config_provider: yaml'. Config 
provider must be set to 'yaml' for standalone mode."

Review Comment:
   could you provide more context on what tests are needed since i've written a 
few? do you mean the $CONF_FILE returning the correct file name?



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