diff --git a/.env.production b/.env.production new file mode 100644 index 0000000..ff715a2 --- /dev/null +++ b/.env.production @@ -0,0 +1 @@ +VITE_API_URI_CONFIG=VITE_API_URI_CONFIG \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 5c805e9..11cffd9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,3 +10,9 @@ FROM nginx as production-stage RUN mkdir /app COPY --from=build-stage /app/dist /app COPY nginx.conf /etc/nginx/nginx.conf + +COPY entrypoint.sh /usr/local/bin/entrypoint.sh +RUN chmod u+x /usr/local/bin/entrypoint.sh + +ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..73cd5b3 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +ROOT_DIR=/app + +# Replace env vars in JavaScript files +echo "Replacing env constants in JS" +for file in $ROOT_DIR/assets/app.*.js* $ROOT_DIR/js/app.*.js* $ROOT_DIR/index.html $ROOT_DIR/precache-manifest*.js; +do + echo "Processing $file ..."; + + sed -i 's|VITE_API_URI_CONFIG|'${VITE_API_URI_CONFIG}'|g' $file + +done + +echo "Starting Nginx" +nginx -g 'daemon off;' \ No newline at end of file diff --git a/src/api/exam/api.metadata.ts b/src/api/exam/api.metadata.ts index e7b148a..b8d6209 100644 --- a/src/api/exam/api.metadata.ts +++ b/src/api/exam/api.metadata.ts @@ -1,11 +1,11 @@ import env from '../index' -const prefix = `${env.API_METADATA_URI}/prefix/` -const religion = `${env.API_METADATA_URI}/religion/` -const relationship = `${env.API_METADATA_URI}/relationship/` -const educationLevel = `${env.API_METADATA_URI}/education-level/` -const province = `${env.API_METADATA_URI}/province/` -const district = `${env.API_METADATA_URI}/district/` -const subDistrict = `${env.API_METADATA_URI}/sub-district/` +const prefix = `${env.API_URI}/metadata/prefix/` +const religion = `${env.API_URI}/metadata/religion/` +const relationship = `${env.API_URI}/metadata/relationship/` +const educationLevel = `${env.API_URI}/metadata/education-level/` +const province = `${env.API_URI}/metadata/province/` +const district = `${env.API_URI}/metadata/district/` +const subDistrict = `${env.API_URI}/metadata/sub-district/` export default { prefix, diff --git a/src/api/index.ts b/src/api/index.ts index 9aa046f..79932ae 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -2,6 +2,8 @@ import { ref } from 'vue' const env = ref(process.env.NODE_ENV || 'development') +export const apiUrlConfig = import.meta.env.VITE_API_URI_CONFIG +console.log(apiUrlConfig) // if (process.env.VUE_APP_TEST) { // env = "test"; // } @@ -9,8 +11,8 @@ const env = ref(process.env.NODE_ENV || 'development') const config = ref({ development: { // API_URI: 'https://localhost:7007/api/v1', - API_URI: 'https://bma-ehr.frappet.synology.me/api/v1', - API_METADATA_URI: 'https://bma-ehr.frappet.synology.me/api/v1/metadata', + API_URI: apiUrlConfig, + // API_METADATA_URI: 'https://bma-ehr.frappet.synology.me/api/v1/metadata', MEET_URI: 'meet.frappet.com' }, test: { @@ -19,20 +21,20 @@ const config = ref({ }, production: { // API_URI: "https://localhost:5010", - API_URI: 'https://bma-ehr.frappet.synology.me/api/v1', - API_METADATA_URI: 'https://bma-ehr.frappet.synology.me/api/v1/metadata', + API_URI: apiUrlConfig, + // API_METADATA_URI: 'https://bma-ehr.frappet.synology.me/api/v1/metadata', MEET_URI: 'meet.frappet.com' } }) const API_URI = ref(config.value[env.value].API_URI) -const API_METADATA_URI = ref(config.value[env.value].API_METADATA_URI) +// const API_METADATA_URI = ref(config.value[env.value].API_METADATA_URI) const MEET_URI = ref(config.value[env.value].MEET_URI) export default { env: env.value, config: config.value, API_URI: API_URI.value, - API_METADATA_URI: API_METADATA_URI.value, + // API_METADATA_URI: API_METADATA_URI.value, MEET_URI: MEET_URI.value } diff --git a/src/modules/01_exam/components/ExamFinished.vue b/src/modules/01_exam/components/ExamFinished.vue index f5de4c1..917158f 100644 --- a/src/modules/01_exam/components/ExamFinished.vue +++ b/src/modules/01_exam/components/ExamFinished.vue @@ -118,7 +118,7 @@ const scoreSum = ref(null) const examResultinscore = ref('') const avatar = ref('') -const dialog = ref(true) +const dialog = ref(false) const rating = ref(5) const text = ref('')