DenoDDeno
Powered by
DubinekD
Denoโ€ข17mo ago
Dubinek

Enviromental variable on GCE

Hi,
I am having weird issue where from some reason, passing env vars on Compute Engine VM doesn't pass the variables into the container where Deno is running. While same command on my local works like a charm. And I am starting to pull my hair, I've renamed to camelCase then to SCREAMING_CASE without luck.
Main.ts
const allowedOrigin = Deno.env.get("ALLOWED_ORIGIN") || "https://127.0.0.1:8081";
const allowedOrigin = Deno.env.get("ALLOWED_ORIGIN") || "https://127.0.0.1:8081";

Dockerfile
FROM denoland/deno:2.0.5
EXPOSE 42069
WORKDIR /app
COPY . .
RUN chown -R deno:deno /app
COPY certs ./certs
USER deno
RUN deno cache main.ts
CMD ["run", "--allow-net", "--allow-env", "--allow-read", "main.ts"]
FROM denoland/deno:2.0.5
EXPOSE 42069
WORKDIR /app
COPY . .
RUN chown -R deno:deno /app
COPY certs ./certs
USER deno
RUN deno cache main.ts
CMD ["run", "--allow-net", "--allow-env", "--allow-read", "main.ts"]

And command that works fine on local, but fails on CoOS on GCE.
docker run -e ALLOWED_ORIGIN=https://example.com -e SOME_VAR=val1 -e SOME_OTH=val2 -p 42069:42069 imageName
docker run -e ALLOWED_ORIGIN=https://example.com -e SOME_VAR=val1 -e SOME_OTH=val2 -p 42069:42069 imageName


I am lost, please help good people here.

Thanks
Deno banner
DenoJoin
Chat about Deno, a modern runtime for JavaScript and TypeScript.
20,934Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?

Similar Threads

setting module scope variable based on module import path
shultz๐Ÿ‡ฎ๐Ÿ‡ฑSshultz๐Ÿ‡ฎ๐Ÿ‡ฑ / help
3y ago
Import from variable path?
PhatsoPPhatso / help
4y ago
Environment Variable always returns undefined
joseJjose / help
3y ago
window variable in fresh islands
rnbguyRrnbguy / help
4y ago