automate environment file creation

added a post install script to the composer.json file to automate the
creation of the .env file which hold app specific configs

also added a helper function to create new keys in the future
This commit is contained in:
ro 2024-06-30 18:45:41 -06:00
parent 928d5468db
commit fb3aff6c85
No known key found for this signature in database
GPG key ID: 29B551CDBD4D3B50
3 changed files with 14 additions and 3 deletions

View file

@ -1,5 +1,7 @@
<?php
use Illuminate\Encryption\Encrypter;
function createUUID()
{
if (function_exists('com_create_guid') === true) {
@ -56,6 +58,11 @@ function randomString(int $length)
return $string;
}
function createAppKey()
{
return 'base64:' . base64_encode(Encrypter::generateKey(config('app.cipher')));
}
function delete_directory($dirPath)
{
if (is_dir($dirPath)) {

View file

@ -67,6 +67,10 @@
],
"start": [
"@php -S localhost:8000 -t public/"
],
"post-install-cmd": [
"php -r \"copy('.env.example', '.env');\"",
"php artisan key:generate"
]
},
"extra": {