Skip to content

Commit

Permalink
refactor: change RELIABILITY_URL and RESILIENCE_URL to GATEWAY_SERVER…
Browse files Browse the repository at this point in the history
…_URL
  • Loading branch information
PromiseFru committed May 14, 2024
1 parent ee8ff5f commit 44bd180
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 15 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/prod-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ jobs:

- name: Create .env.local file
run: |
echo "REACT_APP_RELIABILITY_URL=${{ vars.RELIABILITY_URL }}" > .env.local
echo "REACT_APP_RESILIENCE_URL=${{ vars.RESILIENCE_URL }}" >> .env.local
echo "REACT_APP_GATEWAY_SERVER_URL=${{ vars.GATEWAY_SERVER_URL }}" > .env.local
- name: Install Dependencies
run: yarn install
Expand Down
5 changes: 2 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ RUN yarn install --frozen-lockfile
COPY . .

# Build the application
ARG RELIABILITY_URL
ARG RESILIENCE_URL
RUN export REACT_APP_RELIABILITY_URL=${RELIABILITY_URL} REACT_APP_RESILIENCE_URL=${RESILIENCE_URL} && \
ARG GATEWAY_SERVER_URL
RUN export REACT_APP_GATEWAY_SERVER_URL=${GATEWAY_SERVER_URL} && \
./scripts/generate_env.sh && \
yarn build

Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ To get started with the SMSWithoutBorders Dashboard, follow these simple steps:
1. **Create .env File**: Create a `.env` file in the root directory of the project. Add variables:

```
REACT_APP_RELIABILITY_URL=# reliability data source (replace with actual URL)
REACT_APP_RESILIENCE_URL=# resilience data source (replace with actual URL)
REACT_APP_GATEWAY_SERVER_URL=
```

> [!NOTE]
Expand Down
3 changes: 1 addition & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ services:
context: .
dockerfile: Dockerfile
args:
- RELIABILITY_URL=${RELIABILITY_URL}
- RESILIENCE_URL=${RESILIENCE_URL}
- GATEWAY_SERVER_URL=${GATEWAY_SERVER_URL}
ports:
- ${PORT:-80}:80
- ${SSL_PORT:-443}:443
Expand Down
4 changes: 2 additions & 2 deletions nginx/nginx.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ server {
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload";
add_header X-XSS-Protection "1; mode=block";
add_header Referrer-Policy "strict-origin";
add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://cdnjs.cloudflare.com; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com https://cdnjs.cloudflare.com; font-src 'self' https://fonts.gstatic.com https://cdnjs.cloudflare.com; img-src 'self' data: https://www.google-analytics.com; connect-src 'self' https://www.google-analytics.com https://6616b7bbed6b8fa4348132c4.mockapi.io/api/v1/reliability https://6616b7bbed6b8fa4348132c4.mockapi.io/api/v1/resilience;";
add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://cdnjs.cloudflare.com; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com https://cdnjs.cloudflare.com; font-src 'self' https://fonts.gstatic.com https://cdnjs.cloudflare.com; img-src 'self' data: https://www.google-analytics.com; connect-src 'self' https://www.google-analytics.com https://staging.smswithoutborders.com:15000/v3/clients https://staging.smswithoutborders.com:15000/v3/clients/*/tests;";
add_header Permissions-Policy "geolocation=(),midi=(),sync-xhr=(),microphone=(),camera=(),magnetometer=(),gyroscope=(),fullscreen=(self),payment=()";
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Frame-Options SAMEORIGIN;
add_header X-Content-Type-Options nosniff;

server_tokens off;
Expand Down
3 changes: 1 addition & 2 deletions scripts/generate_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@

# Generate the .env.local file
cat <<EOF > .env.local
REACT_APP_RELIABILITY_URL=$REACT_APP_RELIABILITY_URL
REACT_APP_RESILIENCE_URL=$REACT_APP_RESILIENCE_URL
REACT_APP_GATEWAY_SERVER_URL=$REACT_APP_GATEWAY_SERVER_URL
EOF
3 changes: 2 additions & 1 deletion src/Pages/Reliability.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import DateSearch from "../Components/DateSearch";
import { useNavigate } from "react-router-dom";
import { fetchData } from "../Utils/FetchData";

const apiUrl = process.env.REACT_APP_RELIABILITY_URL;
const gs_url = process.env.REACT_APP_GATEWAY_SERVER_URL;
const apiUrl = `${gs_url}/v3/clients`;
const drawerWidth = 240;
export default function Reliability() {
const navigate = useNavigate();
Expand Down
3 changes: 2 additions & 1 deletion src/Pages/Resilience.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import OperatorSearch from "../Components/OperatorSearch";
import DateSearch from "../Components/DateSearch";
import { fetchData } from "../Utils/FetchData";

const apiUrl = process.env.REACT_APP_RESILIENCE_URL;
const gs_url = process.env.REACT_APP_GATEWAY_SERVER_URL;
const apiUrl = `${gs_url}/v3/clients`;
const drawerWidth = 240;
export default function Resilience() {
const [data, setData] = useState([]);
Expand Down

0 comments on commit 44bd180

Please sign in to comment.