-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
php debug connections refactoring and cleaning up refactoring and cleaning up refactor recipe controller refactoring refactor comment controller refactor user controller fix static analysis
- Loading branch information
Showing
34 changed files
with
539 additions
and
385 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,3 +52,5 @@ INSTAGRAM_REDIRECT_URI= | |
|
||
MAILGUN_DOMAIN= | ||
MAILGUN_SECRET= | ||
|
||
GH_PAT= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: Feature test | ||
name: Run Feature tests | ||
|
||
on: | ||
push: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: Static analysis | ||
name: Run Static analysis | ||
|
||
on: | ||
push: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: Unit test | ||
name: Run Unit tests | ||
|
||
on: | ||
push: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
<?php | ||
|
||
namespace App\Console\Commands; | ||
|
||
use Illuminate\Console\Command; | ||
use Illuminate\Support\Str; | ||
|
||
class DatabaseConnectionDetails extends Command | ||
{ | ||
/** | ||
* The name and signature of the console command. | ||
* | ||
* @var string | ||
*/ | ||
protected $signature = 'db:connection'; | ||
|
||
/** | ||
* The console command description. | ||
* | ||
* @var string | ||
*/ | ||
protected $description = 'Reads the db connection envs from secrets'; | ||
|
||
/** | ||
* Execute the console command. | ||
*/ | ||
public function handle(): void | ||
{ | ||
$connection = [ | ||
"DB_HOST" => "ao9moanwus0rjiex.cbetxkdyhwsb.us-east-1.rds.amazonaws.com", | ||
"DB_PORT" => "3306", | ||
"DB_DATABASE" => "athiftsxpmxaj82c", | ||
"DB_USERNAME" => "w7dydvcjsog985xj", | ||
"DB_PASSWORD" => "iliqkyv8vbbtw603" | ||
]; | ||
|
||
$filepath = $this->envPath(); | ||
|
||
foreach($connection as $key => $value) { | ||
$fileContents = $this->getFileContents($filepath); | ||
|
||
if (Str::contains($fileContents, $key)) { | ||
$this->putFileContents( | ||
$filepath, | ||
preg_replace( | ||
"/{$key}=.*/", | ||
"{$key}={$value}", | ||
$fileContents | ||
) | ||
); | ||
} | ||
} | ||
|
||
$this->info("db connection details set successfully."); | ||
} | ||
|
||
protected function envPath(): string | ||
{ | ||
if (method_exists($this->laravel, 'environmentFilePath')) { | ||
return $this->laravel->environmentFilePath(); | ||
} | ||
|
||
return $this->laravel->basePath('.env'); | ||
} | ||
|
||
protected function getFileContents(string $filepath): string | ||
{ | ||
return file_get_contents($filepath); | ||
} | ||
|
||
protected function putFileContents(string $filepath, string $data): void | ||
{ | ||
file_put_contents($filepath, $data); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.