diff --git a/.env.development b/.env.development deleted file mode 100644 index 6da8916..0000000 --- a/.env.development +++ /dev/null @@ -1,4 +0,0 @@ -VITE_API_BASEURL = "https://ibms-cvilux-api.production.mjmtech.com.tw" -VITE_FILE_API_BASEURL = "https://cgems.cvilux-group.com:8088" -VITE_MQTT_BASEURL = "wss://mqttwss.mjm-staging.developers-homelab.net" -VITE_FORGE_BASEURL = "https://cgems.cvilux-group.com:8088/dist" \ No newline at end of file diff --git a/.env.production b/.env.production deleted file mode 100644 index 41e8aa1..0000000 --- a/.env.production +++ /dev/null @@ -1,4 +0,0 @@ -VITE_API_BASEURL = "https://ibms-cvilux-api.production.mjmtech.com.tw" -VITE_FILE_API_BASEURL = "https://cgems.cvilux-group.com:8088" -VITE_MQTT_BASEURL = "wss://mqttwss.mjm-staging.developers-homelab.net" -# VITE_FORGE_BASEURL = "https://cgems.cvilux-group.com:8088/dist" \ No newline at end of file diff --git a/.env.staging b/.env.staging deleted file mode 100644 index 3a51cfe..0000000 --- a/.env.staging +++ /dev/null @@ -1,3 +0,0 @@ -VITE_API_BASEURL = "http://220.132.206.5:8008" -VITE_FILE_API_BASEURL = "http://220.132.206.5:8085/file" -VITE_FORGE_BASEURL = "http://localhost:5173" \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 46b5725..6ffd4b1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -33,4 +33,8 @@ COPY --from=builder /app/dist /usr/share/nginx/html # 暴露 Nginx 預設的 80 端口 EXPOSE 80 -# Nginx 已經預設啟動,所以不需要 CMD 指令 \ No newline at end of file +# Nginx 已經預設啟動,所以不需要 CMD 指令 +COPY docker-entrypoint.sh /docker-entrypoint.sh +RUN chmod +x /docker-entrypoint.sh +ENTRYPOINT ["/docker-entrypoint.sh"] +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh new file mode 100644 index 0000000..2bbda52 --- /dev/null +++ b/docker-entrypoint.sh @@ -0,0 +1,3 @@ +#!/bin/sh +echo "window.env = { VITE_API_BASEURL: '${VITE_API_BASEURL}', VITE_FILE_API_BASEURL: '${VITE_FILE_API_BASEURL}', VITE_MQTT_BASEURL: '${VITE_MQTT_BASEURL}' };" > /usr/share/nginx/html/env.js +exec "$@" \ No newline at end of file diff --git a/index.html b/index.html index 0f7fd58..81a2361 100644 --- a/index.html +++ b/index.html @@ -17,6 +17,7 @@ type="text/javascript" src="/module/js/com/tridium/js/ext/require/require.min.js?" > --> +
diff --git a/src/apis/graph/api.js b/src/apis/graph/api.js index 427ae7c..73f513b 100644 --- a/src/apis/graph/api.js +++ b/src/apis/graph/api.js @@ -1,5 +1,5 @@ // graph -const BASEURL = import.meta.env.VITE_API_BASEURL; +const BASEURL = window.env?.VITE_API_BASEURL; export const GET_GRAPH_SIDEBAR_API = `/GraphManage/GraphManageTreeList`; export const UPDATE_GRAPH_SIDEBAR_API = `/GraphManage/EditGraphManageTree`; diff --git a/src/apis/history/api.js b/src/apis/history/api.js index 64de717..c0fd361 100644 --- a/src/apis/history/api.js +++ b/src/apis/history/api.js @@ -1,5 +1,5 @@ // history -const BASEURL = import.meta.env.VITE_API_BASEURL; +const BASEURL = window.env?.VITE_API_BASEURL; export const GET_HISTORY_SIDEBAR_API = `/api/History/GetDeviceInfo`; export const GET_HISTORY_POINT_API = `/api/History/GetAllDevPoi`; export const GET_HISTORY_DATA_API = `/api/History/GetHistoryData`; diff --git a/src/components/forge/Forge.vue b/src/components/forge/Forge.vue index e55b62d..49d4d58 100644 --- a/src/components/forge/Forge.vue +++ b/src/components/forge/Forge.vue @@ -1,7 +1,7 @@