diff --git a/template/stacks/ref-implementation/openbao-logging/sidecar-script-configmap.yaml b/template/stacks/ref-implementation/openbao-logging/sidecar-script-configmap.yaml index 639b8d8..0103127 100644 --- a/template/stacks/ref-implementation/openbao-logging/sidecar-script-configmap.yaml +++ b/template/stacks/ref-implementation/openbao-logging/sidecar-script-configmap.yaml @@ -11,9 +11,20 @@ data: start.sh: | #!/bin/sh + echo "Starting mini HTTP server on port 8080..." + while true; do - # Wait for HTTP POST and respond - { echo -ne "HTTP/1.1 200 OK\r\nContent-Length: 26\r\n\r\nSIGHUP sent to OpenBAO"; \ - /tmp/sidecar.sh; } | nc -l -p 8080 -q 1 + echo "Waiting for HTTP POST..." + REQUEST=$(nc -l -p 8080) + + echo "$REQUEST" | grep -q "POST /" && { + echo "Received POST request, sending SIGHUP..." + /tmp/sidecar.sh + RESPONSE="HTTP/1.1 200 OK\r\nContent-Length: 26\r\n\r\nSIGHUP sent to OpenBAO" + } || { + RESPONSE="HTTP/1.1 405 Method Not Allowed\r\nContent-Length: 18\r\n\r\nMethod Not Allowed" + } + + echo -e "$RESPONSE" | nc -N localhost 8081 done \ No newline at end of file