Init test branch and enable Sentry monitoring
This commit is contained in:
parent
ebd116dd35
commit
df3f466b9e
|
@ -26,7 +26,7 @@ TWILIO_SMS_FROM="+447400348273"
|
|||
|
||||
MAIL_HOST=mail.ilink-app.com
|
||||
MAIL_USERNAME=noreply@ilink-app.com
|
||||
MAIL_PASSWORD=ilink2017GA
|
||||
MAIL_PASSWORD=Reply@iLink2022@@@
|
||||
MAIL_FROM_ADDRESS=noreply@ilink-app.com
|
||||
MAIL_FROM_NAME="iLink World"
|
||||
MAIL_ENCRYPTION=tls
|
||||
|
@ -40,3 +40,6 @@ NOTIFICATION_SERVICE_KEY=RfXvPQzQRgwpzQYPnLfWpZzgx4QseHlg
|
|||
|
||||
SWAGGER_GENERATE_ALWAYS=true
|
||||
SWAGGER_DOCS_TOKEN=ZfMqCAdHHrSH8ADdXreIejgjJtOwsH4K
|
||||
|
||||
SENTRY_LARAVEL_DSN=https://9d6f6b6a24514295910a3b0e5bdd1449@o1053292.ingest.sentry.io/4504848762863616
|
||||
SENTRY_TRACES_SAMPLE_RATE=1
|
||||
|
|
|
@ -45,6 +45,10 @@ class Handler extends ExceptionHandler
|
|||
*/
|
||||
public function report(Throwable $exception)
|
||||
{
|
||||
if (app()->bound('sentry') && $this->shouldReport($exception)) {
|
||||
app('sentry')->captureException($exception);
|
||||
}
|
||||
|
||||
parent::report($exception);
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,5 @@ use Laravel\Lumen\Routing\Controller as BaseController;
|
|||
class Controller extends BaseController
|
||||
{
|
||||
//
|
||||
use ApiResponser;
|
||||
use Helper;
|
||||
use ApiResponser, Helper;
|
||||
}
|
||||
|
|
|
@ -3,15 +3,12 @@
|
|||
namespace App\Http\Controllers;
|
||||
|
||||
|
||||
use App\Exceptions\AppException;
|
||||
use App\Models\Agent;
|
||||
use App\Models\AgentPlus;
|
||||
use App\Models\Identification;
|
||||
use App\Models\User;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class UserController extends Controller
|
||||
{
|
||||
|
@ -162,85 +159,6 @@ class UserController extends Controller
|
|||
return $this->successResponse(trans('messages.successful_card_attachment'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws AppException
|
||||
*/
|
||||
public function uploadImage(Request $request, $key, $imageCode, $folderName)
|
||||
{
|
||||
|
||||
// if ($request->hasFile('image')) {
|
||||
$original_filename = $request->file($key)->getClientOriginalName();
|
||||
$original_filename_arr = explode('.', $original_filename);
|
||||
$file_ext = end($original_filename_arr);
|
||||
$image = $imageCode . '-' . Str::uuid() . '.' . $file_ext;
|
||||
|
||||
//Check if the directory already exists.
|
||||
$directoryName = './' . $folderName;
|
||||
if (!is_dir($directoryName)) {
|
||||
//Directory does not exist, so lets create it.
|
||||
mkdir($directoryName, 0755);
|
||||
}
|
||||
|
||||
// Allow certain file formats
|
||||
// $allowTypes = array('jpg', 'png', 'jpeg', 'gif');
|
||||
// if (in_array(strtolower($file_ext), $allowTypes)) {
|
||||
|
||||
$compressedImage = $this->compressImage($request->file($key), './' . $folderName . '/' . $image, 70);
|
||||
if ($compressedImage) {
|
||||
return url($folderName . '/' . $image);
|
||||
} else {
|
||||
throw new AppException(trans('errors.compression_failed'));
|
||||
}
|
||||
// } else {
|
||||
// return $this->errorResponse('Sorry, only JPG, JPEG, PNG, & GIF files are allowed to upload.');
|
||||
// }
|
||||
|
||||
// } else {
|
||||
// return $this->errorResponse('File not found');
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
private function deleteImageFile($filename, $folderName)
|
||||
{
|
||||
// unlink(storage_path('./'.$folderName.'/' . $filename));
|
||||
$path = './' . $folderName . '/' . $filename;
|
||||
if (File::exists($path))
|
||||
File::delete($path);
|
||||
}
|
||||
|
||||
/*
|
||||
* Custom function to compress image size and
|
||||
* upload to the server using PHP
|
||||
*/
|
||||
private function compressImage($source, $destination, $quality)
|
||||
{
|
||||
// Get image info
|
||||
$imgInfo = getimagesize($source);
|
||||
$mime = $imgInfo['mime'];
|
||||
|
||||
// Create a new image from file
|
||||
switch ($mime) {
|
||||
case 'image/jpeg':
|
||||
$image = imagecreatefromjpeg($source);
|
||||
break;
|
||||
case 'image/png':
|
||||
$image = imagecreatefrompng($source);
|
||||
break;
|
||||
case 'image/gif':
|
||||
$image = imagecreatefromgif($source);
|
||||
break;
|
||||
default:
|
||||
$image = imagecreatefromjpeg($source);
|
||||
}
|
||||
|
||||
// Save image
|
||||
imagejpeg($image, $destination, $quality);
|
||||
|
||||
// Return compressed image
|
||||
return $destination;
|
||||
}
|
||||
|
||||
// Mise a jour du mot de passe
|
||||
|
||||
public function updatePassword(Request $request)
|
||||
|
|
|
@ -38,6 +38,7 @@ use Illuminate\Support\Facades\File;
|
|||
use Illuminate\Support\Facades\Input;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Illuminate\Support\Str;
|
||||
use PDO;
|
||||
use Throwable;
|
||||
|
||||
|
@ -585,4 +586,84 @@ trait Helper
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws AppException
|
||||
*/
|
||||
public function uploadImage(Request $request, $key, $imageCode, $folderName)
|
||||
{
|
||||
|
||||
// if ($request->hasFile('image')) {
|
||||
$original_filename = $request->file($key)->getClientOriginalName();
|
||||
$original_filename_arr = explode('.', $original_filename);
|
||||
$file_ext = end($original_filename_arr);
|
||||
$image = $imageCode . '-' . Str::uuid() . '.' . $file_ext;
|
||||
|
||||
//Check if the directory already exists.
|
||||
$directoryName = './' . $folderName;
|
||||
if (!is_dir($directoryName)) {
|
||||
//Directory does not exist, so lets create it.
|
||||
mkdir($directoryName, 0755);
|
||||
}
|
||||
|
||||
// Allow certain file formats
|
||||
// $allowTypes = array('jpg', 'png', 'jpeg', 'gif');
|
||||
// if (in_array(strtolower($file_ext), $allowTypes)) {
|
||||
|
||||
$compressedImage = $this->compressImage($request->file($key), './' . $folderName . '/' . $image, 70);
|
||||
if ($compressedImage) {
|
||||
return url($folderName . '/' . $image);
|
||||
} else {
|
||||
throw new AppException(trans('errors.compression_failed'));
|
||||
}
|
||||
// } else {
|
||||
// return $this->errorResponse('Sorry, only JPG, JPEG, PNG, & GIF files are allowed to upload.');
|
||||
// }
|
||||
|
||||
// } else {
|
||||
// return $this->errorResponse('File not found');
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function deleteImageFile($filename, $folderName)
|
||||
{
|
||||
// unlink(storage_path('./'.$folderName.'/' . $filename));
|
||||
$path = './' . $folderName . '/' . $filename;
|
||||
if (File::exists($path))
|
||||
File::delete($path);
|
||||
}
|
||||
|
||||
/*
|
||||
* Custom function to compress image size and
|
||||
* upload to the server using PHP
|
||||
*/
|
||||
public function compressImage($source, $destination, $quality)
|
||||
{
|
||||
// Get image info
|
||||
$imgInfo = getimagesize($source);
|
||||
$mime = $imgInfo['mime'];
|
||||
|
||||
// Create a new image from file
|
||||
switch ($mime) {
|
||||
case 'image/jpeg':
|
||||
$image = imagecreatefromjpeg($source);
|
||||
break;
|
||||
case 'image/png':
|
||||
$image = imagecreatefrompng($source);
|
||||
break;
|
||||
case 'image/gif':
|
||||
$image = imagecreatefromgif($source);
|
||||
break;
|
||||
default:
|
||||
$image = imagecreatefromjpeg($source);
|
||||
}
|
||||
|
||||
// Save image
|
||||
imagejpeg($image, $destination, $quality);
|
||||
|
||||
// Return compressed image
|
||||
return $destination;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -62,7 +62,9 @@ $app->singleton(
|
|||
$app->configure('app');
|
||||
$app->configure('mail');
|
||||
$app->configure('queue');
|
||||
$app->configure('sentry');
|
||||
$app->configure('variables');
|
||||
$app->configure('services');
|
||||
$app->alias('mailer', Illuminate\Mail\Mailer::class);
|
||||
$app->alias('mailer', Illuminate\Contracts\Mail\Mailer::class);
|
||||
$app->alias('mailer', Illuminate\Contracts\Mail\MailQueue::class);
|
||||
|
@ -104,14 +106,15 @@ $app->routeMiddleware([
|
|||
|
||||
// $app->register(App\Providers\AppServiceProvider::class);
|
||||
// $app->register(App\Providers\AuthServiceProvider::class);
|
||||
// $app->register(App\Providers\EventServiceProvider::class);
|
||||
$app->register(App\Providers\EventServiceProvider::class);
|
||||
$app->register(Illuminate\Database\Eloquent\LegacyFactoryServiceProvider::class);
|
||||
$app->register(Illuminate\Mail\MailServiceProvider::class);
|
||||
$app->register(\SwaggerLume\ServiceProvider::class);
|
||||
$app->register(Maatwebsite\Excel\ExcelServiceProvider::class);
|
||||
$app->register(\Barryvdh\DomPDF\ServiceProvider::class);
|
||||
$app->register(Flipbox\LumenGenerator\LumenGeneratorServiceProvider::class);
|
||||
/*
|
||||
|
||||
/*env
|
||||
|--------------------------------------------------------------------------
|
||||
| Load The Application Routes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
"type": "project",
|
||||
"require": {
|
||||
"php": "^7.3|^8.0",
|
||||
"ext-gd": "*",
|
||||
"ext-json": "*",
|
||||
"barryvdh/laravel-dompdf": "^0.9.0",
|
||||
"brick/money": "^0.5.2",
|
||||
|
@ -16,6 +17,7 @@
|
|||
"laravel/legacy-factories": "^1.1",
|
||||
"laravel/lumen-framework": "^8.0",
|
||||
"maatwebsite/excel": "^3.1",
|
||||
"sentry/sentry-laravel": "2.9",
|
||||
"simplesoftwareio/simple-qrcode": "^4.2",
|
||||
"twilio/sdk": "^6.28"
|
||||
},
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,57 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'dsn' => env('SENTRY_LARAVEL_DSN', env('SENTRY_DSN')),
|
||||
|
||||
// capture release as git sha
|
||||
// 'release' => trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD')),
|
||||
|
||||
// When left empty or `null` the Laravel environment will be used
|
||||
'environment' => env('SENTRY_ENVIRONMENT'),
|
||||
|
||||
'breadcrumbs' => [
|
||||
// Capture Laravel logs in breadcrumbs
|
||||
'logs' => true,
|
||||
|
||||
// Capture SQL queries in breadcrumbs
|
||||
'sql_queries' => true,
|
||||
|
||||
// Capture bindings on SQL queries logged in breadcrumbs
|
||||
'sql_bindings' => true,
|
||||
|
||||
// Capture queue job information in breadcrumbs
|
||||
'queue_info' => true,
|
||||
|
||||
// Capture command information in breadcrumbs
|
||||
'command_info' => true,
|
||||
],
|
||||
|
||||
'tracing' => [
|
||||
// Trace queue jobs as their own transactions
|
||||
'queue_job_transactions' => env('SENTRY_TRACE_QUEUE_ENABLED', false),
|
||||
|
||||
// Capture queue jobs as spans when executed on the sync driver
|
||||
'queue_jobs' => true,
|
||||
|
||||
// Capture SQL queries as spans
|
||||
'sql_queries' => true,
|
||||
|
||||
// Try to find out where the SQL query originated from and add it to the query spans
|
||||
'sql_origin' => true,
|
||||
|
||||
// Capture views as spans
|
||||
'views' => true,
|
||||
|
||||
// Indicates if the tracing integrations supplied by Sentry should be loaded
|
||||
'default_integrations' => true,
|
||||
],
|
||||
|
||||
// @see: https://docs.sentry.io/platforms/php/configuration/options/#send-default-pii
|
||||
'send_default_pii' => false,
|
||||
|
||||
'traces_sample_rate' => (float)(env('SENTRY_TRACES_SAMPLE_RATE', 0.0)),
|
||||
|
||||
'controllers_base_namespace' => env('SENTRY_CONTROLLERS_BASE_NAMESPACE', 'App\\Http\\Controllers'),
|
||||
|
||||
];
|
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'accepted_keys' => env('ACCEPTED_KEYS'),
|
||||
'notification_service' => [
|
||||
'base_uri' => env('NOTIFICATION_SERVICE_URL'),
|
||||
'key' => env('NOTIFICATION_SERVICE_KEY')
|
||||
],
|
||||
'app_url' => env('APP_URL'),
|
||||
'app_debug' => env('APP_DEBUG', false)
|
||||
];
|
|
@ -85,5 +85,5 @@ Paying network : :network :country',
|
|||
"update_banking_information" => "Update your banking information",
|
||||
"wallet_already_linked_to_bank_account" => "Your wallet is already linked to your bank account",
|
||||
"users_group_not_found" => "This group code does not exist",
|
||||
"amount_not_allowed" => "Ce montant n'est pas autorisé. Il doit être compris entre :min et :max"
|
||||
"amount_not_allowed" => "This amount is not allowed. It must be between :min and :max"
|
||||
];
|
||||
|
|
|
@ -105,7 +105,7 @@ Informations de la transaction :
|
|||
- Noms du destinataire : :receiver_name
|
||||
- Montant net : :net_final
|
||||
- Code de retrait : :code',
|
||||
'successful_user_remove_from_wallet_to_cash'=>'Retrait d\'argent personnel
|
||||
'successful_user_remove_from_wallet_to_cash' => 'Retrait d\'argent personnel
|
||||
Informations de la transaction :
|
||||
- Numéro : :id_transaction
|
||||
- Montant de la transaction : :amount
|
||||
|
@ -115,7 +115,7 @@ Informations de la transaction :
|
|||
- Pays de destination : :init_country
|
||||
- Compte émetteur : :sender_code
|
||||
- Code de retrait : :code',
|
||||
'successful_user_remove_from_cart_to_wallet'=>'Retrait d\'argent de votre carte vers votre compte
|
||||
'successful_user_remove_from_cart_to_wallet' => 'Retrait d\'argent de votre carte vers votre compte
|
||||
Informations de la transaction :
|
||||
- Numéro : :id_transaction
|
||||
- Montant de la transaction : :amount
|
||||
|
|
Loading…
Reference in New Issue