Add support for Heroku secret generation

This commit is contained in:
Christopher C. Wells 2021-04-06 09:15:54 -07:00
parent 71ddf0f203
commit cbcac1b43c
2 changed files with 13 additions and 33 deletions

View File

@ -8,43 +8,20 @@
[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy)
After initial deployment the `APP_KEY` environment variable must be set as Heroku's
deploy button does not support the necessary format. This can be set one of two
ways:
#### From App Settings
1. Navigate to the deployed app.
1. Click the "More" menu and select "Run console".
1. Enter the following command and click "Run".
php artisan --no-ansi key:generate --show
1. Copy the output from the command (it should start with `base64:`).
1. Close the console.
1. Navigate to the "Settings" tab, "Config Vars" section.
1. Click "Reveal Config Vars".
1. Enter a new config var with values:
- KEY: `APP_KEY`
- VALUE: *Paste console out copied from Step 4*
1. Click "Add"
The application will restart after setting the config var and login will work.
#### Using Heroku CLI
With the Heroku CLI utility installed and connected to the app, execute:
For a manual deploy using Heroku CLI, execute the following after initial deployment:
heroku run php artisan migrate
heroku run php artisan user:create
heroku config:set APP_KEY=$(php artisan --no-ansi key:generate --show)
#### Search drivers
See the [Search](#search) section for information about supported drivers. Additional
environment variable configuration is necessary when using any search driver other
than the default ("null").
#### Redis Add-on
The [Heroku Redis](https://elements.heroku.com/addons/heroku-redis) add-on can be

View File

@ -117,9 +117,12 @@ return [
| to a random, 32 character string, otherwise these encrypted strings
| will not be safe. Please do this before deploying an application!
|
| MD5 is used here to enforce the 32 character string requirement while
| allowing flexibility in the actual APP_KEY length.
|
*/
'key' => env('APP_KEY'),
'key' => md5(env('APP_KEY')),
'cipher' => 'AES-256-CBC',