【发布时间】:2021-01-31 16:59:19
【问题描述】:
我有一个 quasar 应用程序,它使用 DOTENV - Quasar Framework app extension 从文件 .env 加载配置。
当 quasar 应用程序构建时,它将从 .env 文件加载所有配置,但我想在应用程序启动时加载 .env 文件。
应用在 Kubernetes 上运行,所有配置存储为ConfigMap。在容器启动过程中,我将.env文件挂载如下:
containers:
- name: argo-ui-test
image: "example.io/ui/argo-ui-test:0.1.9"
volumeMounts:
- name: svc-config-url
mountPath: /app/.env
subPath: .env
imagePullPolicy: Always
ports:
- name: http
containerPort: 8080
protocol: TCP
livenessProbe:
httpGet:
path: /
port: http
readinessProbe:
httpGet:
path: /
port: http
resources:
{}
volumes:
- name: svc-config-url
configMap:
name: svc-url
当我查看容器内部时,文件已成功挂载:
drwxr-xr-x 1 root root 4096 Oct 17 10:33 .
drwxr-xr-x 1 root root 4096 Oct 17 10:33 ..
-rw-r--r-- 1 root root 97 Oct 17 10:33 .env
-rw-r--r-- 1 root root 494 Oct 6 09:12 50x.html
drwxr-xr-x 2 root root 4096 Oct 17 09:33 css
-rw-r--r-- 1 root root 16645 Oct 17 09:33 favicon.ico
drwxr-xr-x 2 root root 4096 Oct 17 09:33 fonts
drwxr-xr-x 2 root root 4096 Oct 17 09:33 icons
-rw-r--r-- 1 root root 905 Oct 17 09:33 index.html
drwxr-xr-x 2 root root 4096 Oct 17 09:33 js
I have no name!@argo-ui-test-5c65cb78dc-jnshk:/app$ cat .env
KC_SVC_URL=https://oic.dev.example.io/auth/
USER_SVC_URL=https://user.dev.svc.example.io/api/
quasar 应用在启动时不会从.env 文件中加载配置。
我做错了什么?
【问题讨论】:
标签: javascript vue.js web quasar