Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
22
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"description": "",
"license": "MIT",
"dependencies": {
"serverlesswp": "^0.1.2"
"serverlesswp": "^0.2.0"
},
"engines": {
"node": "18.x"
"node": "22.x"
}
}
2 changes: 1 addition & 1 deletion serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ service: serverlesswp-wordpress-starter

provider:
name: aws
runtime: nodejs18.x
runtime: nodejs22.x
httpApi:
payload: '2.0'

Expand Down
4 changes: 1 addition & 3 deletions test/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM public.ecr.aws/lambda/nodejs:18
FROM public.ecr.aws/lambda/nodejs:22

COPY package.json ${LAMBDA_TASK_ROOT}/
RUN npm install --omit=optional --omit=dev
Expand All @@ -12,6 +12,4 @@ COPY test/installer.php ${LAMBDA_TASK_ROOT}/wp/

RUN sed -i 's#{SQLITE_IMPLEMENTATION_FOLDER_PATH}#/tmp/wp/wp-content/plugins/sqlite-database-integration#' ${LAMBDA_TASK_ROOT}/wp/wp-content/db.php

RUN echo "define('FQDBDIR', '/tmp/db' );" >> ${LAMBDA_TASK_ROOT}/wp/wp-config.php

CMD [ "api/index.handler" ]
7 changes: 4 additions & 3 deletions test/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

./build-test.sh

docker run -p 9000:8080 -d -e FQDBDIR='/tmp/db' --name serverlesswp-test serverlesswp-test
docker run -e FQDBDIR=/tmp/db -p 9000:8080 -d --name serverlesswp-test serverlesswp-test

curl -s -o /dev/null -w "%{http_code}" -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{"path":"/installer.php"}'
curl -s -o /dev/null -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{"path":"/installer.php"}'

curl -s -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{"path":"/"}'

curl -s -o /dev/null -w "%{http_code}" -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{"path":"/"}'

docker stop serverlesswp-test
docker rm serverlesswp-test
4 changes: 2 additions & 2 deletions vercel.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
],
"functions": {
"api/index.js": {
"memory": 1024,
"includeFiles": "wp/**"
"includeFiles": "wp/**",
"maxDuration": 60
}
},
"build": {
Expand Down
11 changes: 10 additions & 1 deletion wp/wp-config.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,18 @@

/* Add any custom values between this line and the "stop editing" line. */

define('MYSQL_CLIENT_FLAGS', MYSQLI_CLIENT_SSL );
if (!isset($_ENV['SKIP_MYSQL_SSL'])) {
define('MYSQL_CLIENT_FLAGS', MYSQLI_CLIENT_SSL );
}

$_SERVER['HTTPS'] = 'on';

// Inject the true host.
$headers = getallheaders();
if (isset($headers['injectHost'])) {
$_SERVER['HTTP_HOST'] = $headers['injectHost'];
}

// Optional S3 credentials for file storage.
if (isset($_ENV['S3_KEY_ID']) && isset($_ENV['S3_ACCESS_KEY'])) {
define( 'AS3CF_SETTINGS', serialize( array(
Expand Down