remove php-cookie-flags from tests, use HTTP(S)_PORT for temp nginx on linux and fix wrong volume path for autoconf tests

This commit is contained in:
bunkerity 2023-03-27 17:36:31 +02:00
parent 461789aed6
commit bf22faddc6
3 changed files with 17 additions and 23 deletions

View file

@ -1,12 +0,0 @@
{
"name": "php-cookie",
"kinds": ["docker"],
"timeout": 60,
"tests": [
{
"type": "string",
"url": "https://www.example.com",
"string": "Cookie 'my_cookie' is set!"
}
]
}

View file

@ -80,8 +80,11 @@ function start() {
log "SYSTEMCTL" "" "Starting BunkerWeb service ..."
# Setup and check /data folder
/usr/share/bunkerweb/helpers/data.sh "SYSTEMCTL"
# Create dummy variables.env
if [ ! -f /etc/bunkerweb/variables.env ]; then
echo -ne "# remove IS_LOADING=yes when your config is ready\nIS_LOADING=yes\nHTTP_PORT=80\nHTTPS_PORT=443\nAPI_LISTEN_IP=127.0.0.1\nSERVER_NAME=\n" > /etc/bunkerweb/variables.env
log "SYSTEMCTL" "" "Created dummy variables.env file"
fi
# Stop scheduler if it's running
stop_scheduler
@ -90,8 +93,16 @@ function start() {
stop_nginx
# Generate temp conf for jobs and start nginx
HTTP_PORT="$(grep "^HTTP_PORT=" /etc/bunkerweb/variables.env | cut -d '=' -f 2)"
if [ "$HTTP_PORT" = "" ] ; then
HTTP_PORT="8080"
fi
HTTPS_PORT="$(grep "^HTTPS_PORT=" /etc/bunkerweb/variables.env | cut -d '=' -f 2)"
if [ "$HTTPS_PORT" = "" ] ; then
HTTPS_PORT="8443"
fi
if [ ! -f /var/tmp/bunkerweb/tmp.env ] ; then
echo -ne "IS_LOADING=yes\nHTTP_PORT=80\nHTTPS_PORT=443\nAPI_LISTEN_IP=127.0.0.1\nSERVER_NAME=\n" > /var/tmp/bunkerweb/tmp.env
echo -ne "IS_LOADING=yes\nHTTP_PORT=${HTTP_PORT}\nHTTPS_PORT=${HTTPS_PORT}\nAPI_LISTEN_IP=127.0.0.1\nSERVER_NAME=\n" > /var/tmp/bunkerweb/tmp.env
fi
/usr/share/bunkerweb/gen/main.py --variables /var/tmp/bunkerweb/tmp.env --no-linux-reload
if [ $? -ne 0 ] ; then
@ -100,10 +111,10 @@ function start() {
fi
# Start nginx
log "SYSTEMCTL" "" "Starting nginx ..."
log "SYSTEMCTL" "" "Starting temp nginx ..."
nginx
if [ $? -ne 0 ] ; then
log "SYSTEMCTL" "❌" "Error while executing nginx"
log "SYSTEMCTL" "❌" "Error while executing temp nginx"
exit 1
fi
count=0
@ -122,11 +133,6 @@ function start() {
fi
log "SYSTEMCTL" "" "nginx started ..."
# Create dummy variables.env
if [ ! -f /etc/bunkerweb/variables.env ]; then
echo -ne "# remove IS_LOADING=yes when your config is ready\nIS_LOADING=yes\nHTTP_PORT=80\nHTTPS_PORT=443\nAPI_LISTEN_IP=127.0.0.1\nSERVER_NAME=\n" > /etc/bunkerweb/variables.env
fi
# Update database
log "SYSTEMCTL" "" "Updating database ..."
if [ ! -f /var/lib/bunkerweb/db.sqlite3 ]; then

View file

@ -58,7 +58,7 @@ class AutoconfTest(Test):
Test.replace_in_file(compose, r"\./bw\-data:/", "/tmp/bw-data:/")
with open(compose, "r") as f :
data = safe_load(f.read())
data["services"]["bunkerweb"]["volumes"] = ["/tmp/www:var/www/html"]
data["services"]["bunkerweb"]["volumes"] = ["/tmp/www:/var/www/html"]
with open(compose, "w") as f :
f.write(dump(data))
proc = run(