Skip to content

Commit

Permalink
ci: add configuration env file support for ngrok domain name
Browse files Browse the repository at this point in the history
  • Loading branch information
MattCMcCoy committed Jan 14, 2024
1 parent 2161b23 commit 5de10ee
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 20 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@

# Go workspace file
go.work

*.DS_Store
*package-lock.json
vendor
*.expo
*node_modules

*.env
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ repos:
- id: check-added-large-files
- id: check-merge-conflict
- id: end-of-file-fixer
exclude: 'backend/docs/'
- id: trailing-whitespace
- id: no-commit-to-branch
args: ['--branch', 'main']
Expand Down
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,14 @@ process can vary, so follow the instructions for each item below!
- This will generate the swagger docs as well as start the backend
- You can now view swagger: http://localhost:8080/swagger/index.html

5. Next, open one last tab to run commands in: run `task start-ngrok`
5. Next, create a .env file in the root directory with a single line:
`EXPO_PUBLIC_API_DOMAIN={your ngrok static domain here}`

- This will just give you a prompt to enter your ngrok domain for example mine
is:
6. Next, open one last tab to run commands in: run `task start-ngrok`

`kind-dane-roughly.ngrok-free.app`

6. Next, open another new tab to run commands in: run `task start-frontend`
7. Next, open another new tab to run commands in: run `task start-frontend`

- This will start the frontend

7. From here follow the prompt in step 6 to launch the frontend on your device
8. From here follow the prompt in step 6 to launch the frontend on your device
of choice
12 changes: 6 additions & 6 deletions Taskfile.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
version: '3'

dotenv: ['.env']
tasks:
build:
- |
Expand Down Expand Up @@ -30,11 +30,11 @@ tasks:
npm start
start-ngrok:
- |
cd backend
echo "Type ngrok domain name:"
read ngrok;
ngrok http --domain=${ngrok} 8080
dotenv: ['.env']
cmds:
- |
cd backend
ngrok http --domain=$EXPO_PUBLIC_API_DOMAIN 8080
start-docker:
- |
Expand Down
2 changes: 1 addition & 1 deletion backend/docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@
}
}
}
}
}
3 changes: 0 additions & 3 deletions client/config.json

This file was deleted.

1 change: 1 addition & 0 deletions client/services/api-links.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const api_url = `https://${process.env.EXPO_PUBLIC_API_DOMAIN}`;
5 changes: 2 additions & 3 deletions client/services/medication.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import axios from 'axios';

import config from '../config.json';
import { api_url } from './api-links';

export const getAllMedications = async (): Promise<Medication[]> => {
const response = await axios.get(`${config['api-link']}/medications`);
const response = await axios.get(`${api_url}/medications`);
return response.data;
};

0 comments on commit 5de10ee

Please sign in to comment.