@@ -44,6 +44,7 @@ This publishes the following files:
4444app/Helpers/secEnv.php
4545config/encryptenv.php
4646app/Console/Commands/EncryptEnvValues.php
47+ app/Console/Commands/SecEnvConsoleCommand.php
4748```
4849
4950#
@@ -59,7 +60,7 @@ Clear out and re-generate your autoload files, otherwise the new files entry you
5960$ composer dump-autoload
6061```
6162#
62- #### Add the new console command to the commands array in ` app/Console/Kernel.php `
63+ #### Add the new console commands to the commands array in ` app/Console/Kernel.php `
6364``` php
6465
6566 /**
@@ -69,7 +70,8 @@ $ composer dump-autoload
6970 */
7071 protected $commands = [
7172 ...
72- 'App\Console\Commands\EncryptEnvValues'
73+ 'App\Console\Commands\EncryptEnvValues',
74+ 'App\Console\Commands\SecEnvConsoleCommand'
7375 ];
7476```
7577#
@@ -245,7 +247,7 @@ variables (or custom config file values).
245247
2462481 . [ Preparing for Encryption] ( #preparing-for-encryption )
2472492 . [ Using the Encryption flag] ( #using-the-encryption-flag )
248- 3 . [ Running the Console Command ] ( #running-the-console-command )
250+ 3 . [ Running the Console Commands ] ( #running-the-console-commands )
2492514 . [ File Permissions] ( #file-permissions )
250252
251253
@@ -350,16 +352,20 @@ return [
350352In both examples (above) the values for APP_KEY, MYSQL_USER, MYSQL_PASS, and SERVICE_API_KEY are flagged for encryption
351353and will be replaced with the encrypted string when running the console command (below).
352354
353- ### Running the Console Command
355+ ### Running the Console Commands
354356
355- To run the encryption sequence in your environment variables file, execute the artisan console command included with this package
357+ #### Encrypting your environment variables
356358
357- The artisan console command encryptenv: encrypt has one optional argument ` configkey ` . Having the config key as an optional
359+ ` php artisan encryptenv:encrypt `
360+
361+ This command will run the encryption sequence in your environment variables file, execute the artisan console command included with this package
362+
363+ There is one optional argument ` configkey ` . Having the config key as an optional
358364argument allows you to add this console command to your own scripts for things like automation in your deployment process.
359365If you do use the configkey argument, it is recommended that you include safeguards to prevent this console command from
360- being recorded in your shell's history (to protect your Config Key).
366+ being recorded in your shell's history (to protect your Config Key).
361367
362- More on this here:
368+ More on protecting your config key here:
363369https://stackoverflow.com/questions/6475524/how-do-i-prevent-commands-from-showing-up-in-bash-history
364370
365371##### Generating a new CONFIGKEY (encryption key)
@@ -382,7 +388,7 @@ You will need to update your web service configuration file with this new CONFIG
382388Refer to the Install [Configure your web service] section in the README for more info
383389```
384390
385- ##### Running Console Command With An Existing CONFIGKEY
391+ ##### Running This Command With An Existing CONFIGKEY
386392
387393If you already have a CONFIGKEY set up and configured for your web service, simply run the encryptenv: encrypt artisan
388394command as follows:
@@ -430,6 +436,20 @@ If you set everything up correctly, Laravel should now be working with your encr
430436
431437Note: You should run ` php artisan config:clear ` to clear your config cache just to be sure everything is truly working.
432438
439+ ### Running console commands that require encrypted environment variables
440+ ` php artisan encryptenv:console `
441+
442+ This command exists to allow you to run console commands that require your environment variables to be decrypted during execution.
443+
444+ For example ` php artisan encryptenv:console 'php artisan migrate' `
445+
446+ The first required argument ` console_command ` which must be wrapped in single quotes or regular quotes
447+
448+ The second optional argument is ` configkey ` . This allows you to add console commands that require the CONFIGKEY to deployment scripts or cron jobs.
449+
450+ As noted above, you should do your due diligence to protect your config key from being saved in your shell's history.
451+
452+
433453### File Permissions
434454
435455You should make ` public/index.php ` read-only to non-privileged users. This prevents a malicious user from adding code to
0 commit comments