I've seen that Deno.env seems to get an information about my PC and some path.
But where does it knows it from? How do I able to fill my own .env file?
The information contained in Deno.env is the same that was provided in Node.js.
These variables are called environment variables.
https://nodejs.org/dist/latest-v8.x/docs/api/process.html#process_process_env
http://man7.org/linux/man-pages/man7/environ.7.html
This is classical for a CLI (like deno) to access user environment variables.
Now if you are trying to fill your environment variables, from an .env file, you need something like this:
https://deno.land/x/dotenv
You can display more information about your Deno.env by running this:
$ deno eval "console.log(Deno.env.toObject())"
OR
// file.ts
console.log(Deno.env.toObject())
https://doc.deno.land/https/github.com/denoland/deno/releases/latest/download/lib.deno.d.ts#Deno.env
Hope this helps!
If you want to fill your own .env you should use the dotenv/mod.ts package:
import { config } from "https://deno.land/x/dotenv/mod.ts";
const greeting = config().GREETING
console.log(greeting);
The .env file:
GREETING = Hello!
Check the documentation for all the options.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With