浏览代码

put all custom configs in stag.php

Josh 4 年之前
父节点
当前提交
e9fe05fc9f

+ 9 - 9
app/Http/Controllers/AppSessionController.php

@@ -29,7 +29,7 @@ class AppSessionController extends Controller
 
         try {
 
-            $url = env('BACKEND_URL', 'http://localhost:8080') . '/api/session/confirmSmsAuthToken';
+            $url = config('stag.backendUrl') . '/api/session/confirmSmsAuthToken';
 
             $data = [
                 'cellNumber' => $request->input('cellNumber'),
@@ -63,7 +63,7 @@ class AppSessionController extends Controller
     public function resendSmsAuthToken(Request $request) {
         try {
 
-            $url = env('BACKEND_URL', 'http://localhost:8080/api') . '/session/resendSmsAuthToken';
+            $url = config('stag.backendUrl') . '/api/session/resendSmsAuthToken';
 
             $data = [];
 
@@ -94,7 +94,7 @@ class AppSessionController extends Controller
     public function postSetPassword(Request $request) {
         try {
 
-            $url = env('BACKEND_URL', 'http://localhost:8080') . '/api/pro/selfPutPassword';
+            $url = config('stag.backendUrl') . '/api/pro/selfPutPassword';
 
             $data = [
                 'newPassword' => $request->input('newPassword'),
@@ -128,7 +128,7 @@ class AppSessionController extends Controller
 
         try {
 
-            $url = env('BACKEND_URL', 'http://localhost:8080') . '/api/pro/selfPutSecurityQuestions';
+            $url = config('stag.backendUrl') . '/api/pro/selfPutSecurityQuestions';
 
             $data = [
                 'securityQuestion1' => $request->input('securityQuestion1'),
@@ -171,7 +171,7 @@ class AppSessionController extends Controller
     {
         try {
 
-            $url = env('BACKEND_URL', 'http://localhost:8080') . '/api/pro/requestPasswordReset';
+            $url = config('stag.backendUrl') . '/api/pro/requestPasswordReset';
 
             $data = [
                 'cellNumber' => $request->input('cellNumber'),
@@ -214,7 +214,7 @@ class AppSessionController extends Controller
     {
         try {
 
-            $url = env('BACKEND_URL', 'http://localhost:8080') . '/api/pro/selfResetPassword';
+            $url = config('stag.backendUrl') . '/api/pro/selfResetPassword';
 
             $data = [
                 'cellNumber' => $request->input('cellNumber'),
@@ -257,7 +257,7 @@ class AppSessionController extends Controller
     }
 
     public function processProLogOut(Request $request){
-        $logOutUrl = env('BACKEND_URL', 'http://localhost:8080/api') . '/session/logOut';
+        $logOutUrl = config('stag.backendUrl') . '/api/session/logOut';
         $response = Http::asForm()->withHeaders(['sessionKey'=>$request->cookie('sessionKey')])->get($logOutUrl)->json();
         if(!$response['success']){
             return back()->with("message", $response['message']);
@@ -326,7 +326,7 @@ class AppSessionController extends Controller
             $data['uid'] = $fields['_uid'];
         }
 
-        $url = env('BACKEND_URL', 'http://localhost:8080') . $request->input('_api');
+        $url = config('stag.backendUrl') . $request->input('_api');
 
         $file = $request->file('file');
         if($file) {
@@ -380,7 +380,7 @@ class AppSessionController extends Controller
             $data['uid'] = $fields['_uid'];
         }
 
-        $url = env('BACKEND_URL', 'http://localhost:8080') . $request->input('_api');
+        $url = config('stag.backendUrl') . $request->input('_api');
         // dd($url);
 
         $response = Http::asForm()

+ 1 - 1
app/Http/Controllers/NoteController.php

@@ -107,7 +107,7 @@ class NoteController extends Controller
     }
 
     private function callJava($request, $endPoint, $data){
-        $url = env('BACKEND_URL', 'http://localhost:8080') . $endPoint;
+        $url = config('stag.backendUrl') . $endPoint;
         $response = Http::asForm()
         ->withHeaders(['sessionKey'=>$request->cookie('sessionKey')])
         ->post($url, $data)

+ 1 - 1
app/Http/Middleware/ProAuthenticated.php

@@ -22,7 +22,7 @@ class ProAuthenticated
         $currentRouteName = $request->route()->getName();
 
         if (!$authenticated) {
-            return redirect(env('AUTH_URL'));
+            return redirect(config('stag.authUrl'));
         }
 
         return $next($request);

+ 1 - 2
app/Lib/Backend.php

@@ -20,7 +20,7 @@ class Backend
 
     public function __construct()
     {
-        $this->url = env('BACKEND_URL', "http://localhost:8080");
+        $this->url = config('stag.backendUrl');
     }
 
 
@@ -34,7 +34,6 @@ class Backend
         return $this->sendRequest($url, 'GET', $data);
     }
 
-
     /**
      * @param string $url
      * @param string $method HTTP request method eg POST, GET.

+ 8 - 0
config/stag.php

@@ -0,0 +1,8 @@
+<?php 
+
+return [
+    'backendUrl' => env('BACKEND_URL','http://localhost:8080'),
+    'stagUrl' => env('AUTH_URL', 'https://scholar.securecpu.com'),
+    'hcpPortalUrl' =>env('HCP_PORTAL_URL', 'https://scholar.securecpu.com'),
+    'tokboxApiKey' =>env('TOKBOX_API_KEY', '46678902')
+];

+ 1 - 1
resources/views/client-dashboard.blade.php

@@ -141,7 +141,7 @@
 
                     var self = this;
 
-                    var apiKey = '<?= env('TOKBOX_API_KEY', '46678902') ?>';
+                    var apiKey = '<?= config('stag.tokboxApiKey') ?>';
                     var sessionId = this.otSessionId;
                     var token = this.selfToken;
 

+ 2 - 2
resources/views/layouts/pro-logged-in.blade.php

@@ -80,7 +80,7 @@
                 </li>
 
                 <li class="nav-item">
-                    <a class="nav-link small d-flex align-items-center" href="{{env('HCP_PORTAL_URL', 'https://scholar.securecpu.com')}}/pro_log_in_with_session_key/{{$performer->session_key}}" title="">
+                    <a class="nav-link small d-flex align-items-center" href="{{config('stag.hcpPortalUrl')}}/pro_log_in_with_session_key/{{$performer->session_key}}" title="">
                         Go to HCP portal
                     </a>
                 </li>
@@ -100,7 +100,7 @@
 
             <ul class="navbar-nav ml-2 ml-2">
                 <li class="nav-item">
-                    <a class="nav-link px-2" href="{{ env('AUTH_URL') }}/logout" target="_top" role="button">
+                    <a class="nav-link px-2" href="{{ config('app.authUrl') }}/logout" target="_top" role="button">
                         <i class="fas fa-sign-out-alt"></i>
                     </a>
                 </li>

+ 1 - 1
resources/views/meet.blade.php

@@ -236,7 +236,7 @@
 
                     var self = this;
 
-                    var apiKey = '<?= env('TOKBOX_API_KEY', '46678902') ?>';
+                    var apiKey = '<?=  config('stag.tokboxApiKey') ?>';
                     var sessionId = this.otSessionId;
                     var token = this.selfToken;
 

+ 1 - 1
resources/views/pro-call.blade.php

@@ -176,7 +176,7 @@
 
                     var self = this;
 
-                    var apiKey = '<?= env('TOKBOX_API_KEY', '46678902') ?>';
+                    var apiKey = '<?=  config('stag.tokboxApiKey') ?>';
                     var sessionId = this.otSessionId;
                     var token = this.selfToken;
 

+ 1 - 1
routes/web.php

@@ -69,7 +69,7 @@ Route::middleware('pro.auth')->group(function() {
 Route::post('/post-to-api', 'AppSessionController@postToAPI')->name('post-to-api');
 Route::post('/post-to-api-ajax', 'AppSessionController@postToAPIAjax')->name('post-to-api-ajax');
 Route::post("/process_form_submit", 'NoteController@processFormSubmit')->name('process_form_submit');
-if (env('APP_ENV') === 'production') {
+if (config('app.env') === 'production') {
     URL::forceScheme('https');
 }
 // =============================================================================================