Skip to content

Commit

Permalink
Update environment variables for production deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
tobifra committed Aug 18, 2024
1 parent 0ea776d commit 64390a2
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,20 @@ jobs:
MAIL_FROM_ADDRESS: ${{ secrets.MAIL_FROM_ADDRESS }}
MAIL_FROM_NAME: ${{ secrets.MAIL_FROM_NAME }}
APP_KEY: ${{ secrets.APP_KEY }}
FRONTEND_URL: ${{ vars.FRONTEND_URL }}
CREDITOR_NAME: ${{ vars.CREDITOR_NAME }}
CREDITOR_STREET: ${{ vars.CREDITOR_STREET }}
CREDITOR_TOWN: ${{ vars.CREDITOR_TOWN }}
CREDITOR_ZIP: ${{ vars.CREDITOR_ZIP }}
CREDITOR_IBAN: ${{ vars.CREDITOR_IBAN }}
CREDITOR_EMAIL: ${{ vars.CREDITOR_EMAIL }}

run: |
cd ./api
rm -f .env
cp env.example .env
sed -ri "s~^APP_URL=.*$~APP_URL=$BACKEND_URL~" .env
sed -ri "s~^FRONTEND_URL=.*$~FRONTEND_URL=$FRONTEND_URL~" .env
sed -ri "s~^DB_HOST=.*$~DB_HOST=$DB_HOST~" .env
sed -ri "s~^DB_DATABASE=.*$~DB_DATABASE=$DB_DATABASE~" .env
sed -ri "s~^DB_USERNAME=.*$~DB_USERNAME=$DB_USERNAME~" .env
Expand All @@ -92,6 +101,12 @@ jobs:
sed -ri "s~^MAIL_FROM_ADDRESS=.*$~MAIL_FROM_ADDRESS=$MAIL_FROM_ADDRESS~" .env
sed -ri "s~^MAIL_FROM_NAME=.*\$~MAIL_FROM_NAME=\"$MAIL_FROM_NAME\"~" .env
sed -ri "s~^APP_KEY=.*$~APP_KEY=$APP_KEY~" .env
sed -ri "s~^CREDITOR_NAME=.*\$~CREDITOR_NAME=\"$CREDITOR_NAME\"~" .env
sed -ri "s~^CREDITOR_STREET=.*\$~CREDITOR_STREET=\"$CREDITOR_STREET\"~" .env
sed -ri "s~^CREDITOR_TOWN=.*\$~CREDITOR_TOWN=\"$CREDITOR_TOWN\"~" .env
sed -ri "s~^CREDITOR_ZIP=.*\$~CREDITOR_ZIP=\"$CREDITOR_ZIP\"~" .env
sed -ri "s~^CREDITOR_IBAN=.*\$~CREDITOR_IBAN=\"$CREDITOR_IBAN\"~" .env
sed -ri "s~^CREDITOR_EMAIL=.*\$~CREDITOR_EMAIL=\"$CREDITOR_EMAIL\"~" .env
- name: Deploy backend via SSH
env:
Expand Down
2 changes: 2 additions & 0 deletions api/config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,6 @@
'email' => env('CREDITOR_EMAIL', ''),
],

'frontend_url' => env('FRONTEND_URL', ''),

];
5 changes: 3 additions & 2 deletions api/env.example
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
APP_NAME=Laravel
APP_ENV=local
APP_ENV=production
APP_KEY=
APP_DEBUG=true
APP_DEBUG=false
APP_TIMEZONE=UTC
APP_URL=http://localhost
FRONTEND_URL=localhost:8080

APP_LOCALE=de
APP_FALLBACK_LOCALE=en
Expand Down
2 changes: 1 addition & 1 deletion api/routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
use Illuminate\Support\Facades\Route;

Route::get('/', function () {
return view('welcome');
return redirect(config('app.frontend_url'));
});

0 comments on commit 64390a2

Please sign in to comment.