Skip to content

Commit

Permalink
Better configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
ir4y committed Aug 8, 2024
1 parent 337f55b commit 168945c
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 17 deletions.
28 changes: 15 additions & 13 deletions shared/src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
export const baseURL =
(window as any).BASE_URL === '{{BASE_URL}}'
? 'http://localhost:8080/'
: (window as any).BASE_URL;
export const juteURL =
(window as any).JUTE_URL === '{{JUTE_URL}}'
? 'http://localhost:8099/'
: (window as any).JUTE_URL;
function getConfig(key: string, defaultValue: string) {
const value = (window as any)[key];
if (value === '{{' + key + '}}' || value === null || value === undefined) {
return defaultValue;
}
return value;
}

export const aiQuestionnaireBuilderUrl = 'https://builder.emr.beda.software';
// export const aiQuestionnaireBuilderUrl = 'http://localhost:3002';
export const fhirpathMappingUrl = 'https://fhirpathmapper.emr.beda.software';
// export const fhirpathMappingUrl = 'http://localhost:8091';
export const fhirMappingLanguageUrl = 'http://localhost:8084/matchboxv3/fhir'
export const baseURL = getConfig('BASE_URL', 'http://localhost:8080');
export const juteURL = getConfig('JUTE_URL', 'http://localhost:8099');
export const aiQuestionnaireBuilderUrl = getConfig('AI_BUILDER_URL', 'http://localhost:3002');
export const fhirMappingLanguageUrl = getConfig(
'FHIR_MAPPING_LANGUAGE_URL',
'http://localhost:8084/matchboxv3/fhir',
);
export const fhirpathMappingUrl = getConfig('FHIRPATH_MAPPING_URL', 'http://localhost:8091');
10 changes: 7 additions & 3 deletions web/public/docker_entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#!/bin/sh -e
sed s/{{BASE_URL}}/$BASE_URL/g index.html > index2.html
sed s/{{JUTE_URL}}/$JUTE_URL/g index2.html > index3.html
mv index3.html index.html
sed -i \
-e s/{{BASE_URL}}/$BASE_URL/g \
-e s/{{JUTE_URL}}/$JUTE_URL/g \
-e s/{{AI_BUILDER_URL}}/$AI_BUILDER_URL/g \
-e s/{{FHIR_MAPPING_LANGUAGE_URL}}/$FHIR_MAPPING_LANGUAGE_URL/g \
-e s/{{FHIRPATH_MAPPING_URL}}/$FHIRPATH_MAPPING_URL/g \
index.html

serve -n -s -l tcp://0.0.0.0:5000
5 changes: 4 additions & 1 deletion web/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
<script>
window.BASE_URL = "{{BASE_URL}}"
window.JUTE_URL = "{{JUTE_URL}}"
window.AI_BUILDER_URL = "{{AI_BUILDER_URL}}"
window.FHIR_MAPPING_LANGUAGE_URL= "{{FHIR_MAPPING_LANGUAGE_URL}}"
window.FHIRPATH_MAPPING_URL= "{{FHIRPATH_MAPPING_URL}}"
</script>
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
Expand Down Expand Up @@ -36,4 +39,4 @@
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>
</html>

0 comments on commit 168945c

Please sign in to comment.