Last active
August 16, 2020 21:06
-
-
Save viktorfa/23847bd9f9926872f860455329b0153e to your computer and use it in GitHub Desktop.
Server config for Strapi in Serverless
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// config/server.js | |
// This config is used both in `strapi build` and `strapi start`. | |
// So if we have a path prefix to the api, such as /dev or /v1, | |
// we need to use env variables to configure, as Strapi doesn't | |
// support path prefixes automagically. | |
module.exports = ({ env }) => { | |
let url = "<Insert Lambda endpoint url here after deploy.>"; | |
// Check if running in serverless-offline | |
if (env("IS_OFFLINE", null) === "true") { | |
url = "http://localhost:3000/dev"; | |
} | |
return { | |
host: env("HOST", "0.0.0.0"), | |
port: env.int("PORT", 1337), | |
url, | |
admin: { | |
serveAdminPanel: false, // No admin panel | |
autoOpen: false, | |
url: "/", | |
auth: { | |
secret: env("ADMIN_JWT_SECRET", "Insert random string as env variable in production"), | |
}, | |
}, | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment