mirror of
https://github.com/fabriziosalmi/patterns.git
synced 2025-12-17 09:45:34 +00:00
action fix
This commit is contained in:
parent
d2a51a1e17
commit
69dbb9caa6
21
.github/workflows/nginx.yml
vendored
21
.github/workflows/nginx.yml
vendored
@ -41,21 +41,6 @@ jobs:
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Patch .conf files to fix if directives
|
||||
run: |
|
||||
for file in waf_rules/waf_patterns/nginx/*.conf; do
|
||||
echo "Patching $file to ensure 'if' directives are inside a server block..."
|
||||
if grep -q "if " "$file" && ! grep -q "server {" "$file"; then
|
||||
echo "Adding server block to $file..."
|
||||
echo "server {" > temp.conf
|
||||
cat "$file" >> temp.conf
|
||||
echo "}" >> temp.conf
|
||||
mv temp.conf "$file"
|
||||
fi
|
||||
done
|
||||
echo "Patched files:"
|
||||
ls -l waf_rules/waf_patterns/nginx/*.conf
|
||||
|
||||
- name: Verify nginx.conf exists
|
||||
run: |
|
||||
if [ ! -f "tests/nginx.conf" ]; then
|
||||
@ -75,6 +60,10 @@ jobs:
|
||||
echo " include /etc/nginx/$(basename $file);" >> temp_nginx.conf
|
||||
echo "}" >> temp_nginx.conf
|
||||
|
||||
# Debug: Print the temporary nginx.conf
|
||||
echo "Temporary nginx.conf for validation:"
|
||||
cat temp_nginx.conf
|
||||
|
||||
# Validate the file using Docker
|
||||
docker run --rm -v $(pwd)/$file:/etc/nginx/$(basename $file):ro \
|
||||
-v $(pwd)/temp_nginx.conf:/etc/nginx/nginx.conf:ro \
|
||||
@ -92,4 +81,4 @@ jobs:
|
||||
-v $(pwd)/merged_waf_rules.conf:/etc/nginx/merged_waf_rules.conf:ro \
|
||||
-v $(pwd)/tests/nginx.conf:/etc/nginx/tests/nginx.conf:ro \
|
||||
-v $(pwd)/temp_nginx.conf:/etc/nginx/nginx.conf:ro \
|
||||
nginx nginx -t
|
||||
nginx nginx -t
|
||||
Loading…
x
Reference in New Issue
Block a user