This a part of my webpack file.
output: {
filename: "[name].[chunkhash:8].js",
path: path.resolve(__dirname, "../../dist/static/"),
publicPath: `${**process.env.STATIC_URL**}/xxxxxxx/static/`
}
I want to access environment variables set in configmap of kubernetes here. Is there a way to do that?
There is a dedicated envFrom:
field in the PodSpec that allows injecting ConfigMap keys as environment variables (assuming they are "environment safe," so no integers or boolean or non-string values):
containers:
- image: whatever
envFrom:
configMapRef:
name: your-configmap-name-goes-here
Or, if you just want that one key, then there is a similar valueFrom:
field in the env:
items themselves:
containers:
- image: whatever
env:
- name: STATIC_URL
valueFrom:
configMapKeyRef:
name: your-configmap-name-goes-here
key: whatever-key-holds-the-static-url-value