Remove sensitive data from the tracked config files after running october:env
This commit is contained in:
parent
8df92f4ba1
commit
0ac7f340be
|
|
@ -24,6 +24,18 @@ class OctoberEnv extends Command
|
|||
*/
|
||||
protected $description = 'Creates .env file with default configuration values.';
|
||||
|
||||
/**
|
||||
* @var array The env keys that need to have their original values removed from the config files
|
||||
*/
|
||||
protected $protectedKeys = [
|
||||
'APP_KEY',
|
||||
'DB_USERNAME',
|
||||
'DB_PASSWORD',
|
||||
'MAIL_USERNAME',
|
||||
'MAIL_PASSWORD',
|
||||
'REDIS_PASSWORD',
|
||||
];
|
||||
|
||||
/**
|
||||
* The current config cursor.
|
||||
*/
|
||||
|
|
@ -184,6 +196,11 @@ class OctoberEnv extends Command
|
|||
|
||||
$this->saveEnvSettings($envKey, $value);
|
||||
|
||||
// Remove protected values from the config files
|
||||
if (in_array($envKey, $this->protectedKeys) && !empty($value)) {
|
||||
$value = "''";
|
||||
}
|
||||
|
||||
return $this->isEnv($matches[0]) ? $matches[0] : "'$configKey' => env('$envKey', {$value}),";
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue