#load.ts of dotenv module not working

29 messages · Page 1 of 1 (latest)

muted rain
#

Can you show some code? How are you using this dotenv module? Is it from std or is it another one.

cedar matrix
#

std

#
import "https://deno.land/[email protected]/dotenv/load.ts";

console.log('a', Deno.env.get('COLLECTION'));
muted rain
#

And i assume your .env file has a line like COLLECTION=asdf?

cedar matrix
#

yes

#

can't show my dotenv file because it contains sensitive credentials

#

it doesnt even print a undefined

#

it just prints a

muted rain
#

So COLLECTION might be an empty string

cedar matrix
#

i can print any variable inside my dotenv file

muted rain
#

Actually no nevermimd

cedar matrix
#

and it just prints nothing

muted rain
#

You can try Deno.env.toObject() i guess

cedar matrix
#

let me try

#

but i dont get it why everything was working before and not now

muted rain
#

Is the .env file in the same folder as where you run the file?

#

Maybe you can upgrade to 0.158.0 just in case

cedar matrix
#

hold on even if it would make no sense lemme restart my computer since its pretty bad

#

ok im there

#

let me try running this again

#

still doesnt work

#

even with toObject

#

it wont work

#

changing the version of std

#

nothing

#

actually now i even try to use Deno.env.set just for testing and even after i have declared using .set a variable, if i try to print it it just wont

#

so maybe

#

its not the load.ts module not working

#

its the Deno object