#!/bin/sh
set -eu
for path in / /gde /modules/sepa /modules/peppol /modules/banque /documentation; do
  code=$(curl --silent --show-error --retry 5 --retry-delay 1 --connect-timeout 5 --max-time 20 -o /dev/null -w '%{http_code}' "http://127.0.0.1:8082$path")
  printf '%s %s\n' "$code" "$path"
  test "$code" = 200
done
for path in /.env /test.php /inexistante; do
  code=$(curl --silent --show-error --connect-timeout 5 --max-time 20 -o /dev/null -w '%{http_code}' "http://127.0.0.1:8082$path")
  printf '%s %s\n' "$code" "$path"
  case "$code" in 403|404) ;; *) exit 1 ;; esac
done
