This tutorials isn’t up to date one the last part Adding Environment Variables to Strapi
After creating the file ./config/env/production/database.js
you need also :
- Create your Strapi server config for production. Create file
./config/env/production/server.js
and add this code
module.exports = ({ env }) => ({
proxy: true,
url: env('MY_HEROKU_URL'),
app: {
keys: env.array('APP_KEYS')
},
})
- After that you need to add variables needed, you can do this manually or with the Heroku CLI
heroku config:set MY_HEROKU_URL=$(heroku info -s | grep web_url | cut -d= -f2)
heroku config:set APP_KEYS=$(cat .env | grep APP_KEYS | cut -d= -f2-)
heroku config:set API_TOKEN_SALT=$(cat .env | grep API_TOKEN_SALT | cut -d= -f2)
heroku config:set ADMIN_JWT_SECRET=$(cat .env | grep ADMIN_JWT_SECRET | cut -d= -f2)
heroku config:set JWT_SECRET=$(cat .env | grep -w JWT_SECRET | cut -d= -f2)
- And don’t forget to set your production environment - same, manually or with CLI
heroku config:set NODE_ENV=production
After that enjoy !
You can find this on the Strapi doc (at the 7th bullet point - not show in summary little bug I presume) Strapi doc