เพิ่ม env api
This commit is contained in:
parent
34d9066272
commit
ef96698845
6 changed files with 39 additions and 14 deletions
1
.env.production
Normal file
1
.env.production
Normal file
|
|
@ -0,0 +1 @@
|
|||
VITE_API_URI_CONFIG=VITE_API_URI_CONFIG
|
||||
|
|
@ -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;"]
|
||||
16
entrypoint.sh
Normal file
16
entrypoint.sh
Normal file
|
|
@ -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;'
|
||||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@
|
|||
import { ref } from 'vue'
|
||||
|
||||
const env = ref<string>(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<string>(process.env.NODE_ENV || 'development')
|
|||
const config = ref<any>({
|
||||
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<any>({
|
|||
},
|
||||
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<string>(config.value[env.value].API_URI)
|
||||
const API_METADATA_URI = ref<string>(config.value[env.value].API_METADATA_URI)
|
||||
// const API_METADATA_URI = ref<string>(config.value[env.value].API_METADATA_URI)
|
||||
const MEET_URI = ref<string>(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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ const scoreSum = ref<number | null>(null)
|
|||
const examResultinscore = ref<string>('')
|
||||
const avatar = ref<string>('')
|
||||
|
||||
const dialog = ref<boolean>(true)
|
||||
const dialog = ref<boolean>(false)
|
||||
const rating = ref<number>(5)
|
||||
const text = ref<string>('')
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue