Skip to content

Commit

Permalink
Add ENV variables for external api links
Browse files Browse the repository at this point in the history
  • Loading branch information
wilwong89 committed Jun 3, 2024
1 parent b86f909 commit 47a4f72
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 11 deletions.
2 changes: 2 additions & 0 deletions .github/environments/values.dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ config:
FRONTEND_CHES_BCC: [email protected]
FRONTEND_COMS_APIPATH: https://coms-dev.api.gov.bc.ca/api/v1
FRONTEND_COMS_BUCKETID: 1f9e1451-c130-4804-aeb0-b78b5b109c47
FRONTEND_GEOCODER_APIPATH: https://geocoder.api.gov.bc.ca
FRONTEND_ORGBOOK_APIPATH: https://orgbook.gov.bc.ca/api/v4
FRONTEND_OIDC_AUTHORITY: https://dev.loginproxy.gov.bc.ca/auth/realms/standard
FRONTEND_OIDC_CLIENTID: nr-permit-connect-navigator-service-5188
SERVER_APIPATH: /api/v1
Expand Down
2 changes: 2 additions & 0 deletions .github/environments/values.prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ config:
FRONTEND_CHES_BCC: [email protected]
FRONTEND_COMS_APIPATH: https://coms.api.gov.bc.ca/api/v1
FRONTEND_COMS_BUCKETID: 0089d041-5aab-485e-842d-8875475d0ed6
FRONTEND_GEOCODER_APIPATH: https://geocoder.api.gov.bc.ca
FRONTEND_ORGBOOK_APIPATH: https://orgbook.gov.bc.ca/api/v4
FRONTEND_OIDC_AUTHORITY: https://loginproxy.gov.bc.ca/auth/realms/standard
FRONTEND_OIDC_CLIENTID: nr-permit-connect-navigator-service-5188
SERVER_APIPATH: /api/v1
Expand Down
2 changes: 2 additions & 0 deletions .github/environments/values.test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ config:
FRONTEND_CHES_BCC: [email protected]
FRONTEND_COMS_APIPATH: https://coms-test.api.gov.bc.ca/api/v1
FRONTEND_COMS_BUCKETID: a9eabd1d-5f77-4c60-bf6b-83ffa0e21c59
FRONTEND_GEOCODER_APIPATH: https://geocoder.api.gov.bc.ca
FRONTEND_ORGBOOK_APIPATH: https://orgbook.gov.bc.ca/api/v4
FRONTEND_OIDC_AUTHORITY: https://test.loginproxy.gov.bc.ca/auth/realms/standard
FRONTEND_OIDC_CLIENTID: nr-permit-connect-navigator-service-5188
SERVER_APIPATH: /api/v1
Expand Down
4 changes: 3 additions & 1 deletion app/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ app.use(
'default-src': [
"'self'", // eslint-disable-line
new URL(config.get('frontend.oidc.authority')).origin,
new URL(config.get('frontend.coms.apiPath')).origin
new URL(config.get('frontend.coms.apiPath')).origin,
new URL(config.get('frontend.geocoder.apiPath')).origin,
new URL(config.get('frontend.orgbook.apiPath')).origin
]
}
}
Expand Down
8 changes: 5 additions & 3 deletions app/config/custom-environment-variables.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
"apiPath": "FRONTEND_COMS_APIPATH",
"bucketId": "FRONTEND_COMS_BUCKETID"
},
"externalApi": {
"geocoderApi": "FRONTEND_GEOCODER_APIPATH",
"orgBookApi": "FRONTEND_ORGBOOK_APIPATH"
"geocoder": {
"apiPath": "FRONTEND_GEOCODER_APIPATH"
},
"orgbook": {
"apiPath": "FRONTEND_ORGBOOK_APIPATH"
},
"notificationBanner": "FRONTEND_NOTIFICATION_BANNER",
"oidc": {
Expand Down
2 changes: 2 additions & 0 deletions charts/pcns/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ config:
FRONTEND_CHES_BCC: ~
FRONTEND_COMS_APIPATH: ~
FRONTEND_COMS_BUCKETID: ~
FRONTEND_GEOCODER_APIPATH: ~
FRONTEND_ORGBOOK_APIPATH: ~
FRONTEND_OIDC_AUTHORITY: ~
FRONTEND_OIDC_CLIENTID: ~

Expand Down
9 changes: 4 additions & 5 deletions frontend/src/components/intake/ShasIntakeForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -213,18 +213,18 @@ async function onSubmit(data: any) {
}
}
const onRegisteredNameInput = async (e: AutoCompleteCompleteEvent) => {
async function onRegisteredNameInput(e: AutoCompleteCompleteEvent) {
if (e?.query?.length >= 2) {
const results = (await externalApiService.searchOrgBook(e.query))?.data?.results ?? [];
orgBookOptions.value = results
.filter((x: { [key: string]: string }) => x.type === 'name')
.map((x: { [key: string]: string }) => x?.value);
}
};
}
const getRegisteredNameLabel = (e: any) => {
function getRegisteredNameLabel(e: any) {
return e;
};
}
onBeforeMount(async () => {
let response;
Expand Down Expand Up @@ -254,7 +254,6 @@ onBeforeMount(async () => {
</script>

<template>
<div>{{ formRef?.values }}</div>
<div v-if="!assignedActivityId">
<Form
v-if="initialFormValues"
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/services/interceptors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export function comsAxios(options: AxiosRequestConfig = {}): AxiosInstance {
*/
export function geocoderAxios(options: AxiosRequestConfig = {}): AxiosInstance {
const instance = axios.create({
baseURL: new ConfigService().getConfig().externalApi.geocoderApi,
baseURL: new ConfigService().getConfig().geocoder.apiPath,
timeout: 10000,
paramsSerializer,
...options
Expand All @@ -105,7 +105,7 @@ export function geocoderAxios(options: AxiosRequestConfig = {}): AxiosInstance {
*/
export function orgBookAxios(options: AxiosRequestConfig = {}): AxiosInstance {
const instance = axios.create({
baseURL: new ConfigService().getConfig().externalApi.orgBookApi,
baseURL: new ConfigService().getConfig().orgbook.apiPath,
timeout: 10000,
paramsSerializer,
...options
Expand Down

0 comments on commit 47a4f72

Please sign in to comment.