Browse Source

feat(www): disable rate limit on api/ for e2e tests

Peter Thomassen 5 years ago
parent
commit
c67944d2a0

+ 6 - 0
docker-compose.test-e2e.yml

@@ -2,6 +2,12 @@ version: '2.2'
 
 # mostly extending from main .yml
 services:
+  www:
+    environment:
+    - DESECSTACK_E2E_TEST=TRUE # increase abuse limits and such
+    logging:
+      driver: "json-file"
+
   api:
     environment:
     - DESECSTACK_E2E_TEST=TRUE # increase abuse limits and such

+ 1 - 1
www/conf/sites-available/90-desec.api.location → www/conf/sites-available/90-desec.api.location.var

@@ -4,7 +4,7 @@
 location /api/ {
     # max .5r/s to the API per IP, but 10 at once is okay. This limit may need to be increased once
     # client applications become more powerful
-    limit_req zone=perip-api burst=10 nodelay;
+    ${PROD_ONLY} limit_req zone=perip-api burst=10 nodelay;
 
     expires epoch;
     etag off;

+ 8 - 2
www/conf/sites-available/envreplace.sh

@@ -3,7 +3,13 @@
 # https://stackoverflow.com/questions/59895/can-a-bash-script-tell-which-directory-it-is-stored-in
 DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
 
-for file in $DIR/*.conf.var; do
+export PROD_ONLY=
+if [[ $DESECSTACK_E2E_TEST = "TRUE" ]]
+then
+    export PROD_ONLY='#'
+fi
+
+for file in $DIR/*.var; do
     # we only replace occurances of the variables specified below as first argument
-    (envsubst '$DESECSTACK_DOMAIN' | envsubst '$CERT_PATH') < $file > $DIR/`basename $file .var`
+    (envsubst '$DESECSTACK_DOMAIN' | envsubst '$CERT_PATH' | envsubst '$PROD_ONLY' ) < $file > $DIR/`basename $file .var`
 done