Skip to content

Commit

Permalink
oper: adicionando .env para pegar o ip do backend na aws
Browse files Browse the repository at this point in the history
  • Loading branch information
iagocpv committed Nov 12, 2024
1 parent e2192c6 commit 5b0748b
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .github/workflows/ec2deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
env:
AWS_PRIVATE_KEY: ${{ secrets.KEYAWS }}
EC2_IP: ${{ secrets.EC2_IP }}
BACKEND_PORT: ${{ secrets.BACKEND_PORT }}
SSH_OPTIONS: '-o StrictHostKeyChecking=no -i key.pem ubuntu@${{ secrets.EC2_IP }}'

jobs:
Expand Down Expand Up @@ -51,6 +52,10 @@ jobs:
run: |
scp -o StrictHostKeyChecking=no -i key.pem -r ./tupan/ ubuntu@${{ env.EC2_IP }}:/home/ubuntu/tupan
- name: Create .env file
run: |
echo "BACKEND_URL=${{ env.EC2_IP }}:${{ env.BACKEND_PORT }}/" >> tupan/.env
- name: SSH into AWS and build Docker image
run: |
ssh ${{ env.SSH_OPTIONS }} 'cd /home/ubuntu/tupan/tupan && sudo docker build -t tupan-front .'
Expand Down
1 change: 1 addition & 0 deletions tupan/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
# misc
.DS_Store
*.pem
.env

# debug
npm-debug.log*
Expand Down
13 changes: 13 additions & 0 deletions tupan/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions tupan/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"dependencies": {
"@material-tailwind/react": "^2.1.10",
"axios": "^1.7.7",
"dotenv": "^16.4.5",
"flowbite": "^2.5.1",
"highcharts": "^11.4.8",
"js-cookie": "^3.0.5",
Expand Down
5 changes: 4 additions & 1 deletion tupan/src/app/_api/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
export const api_route: string = 'http://localhost:8000/';
import * as dotenv from 'dotenv';
dotenv.config();

export const api_route: string = process.env.BACKEND_URL || 'http://localhost:8000/';

0 comments on commit 5b0748b

Please sign in to comment.