tessel / t2-start

Tessel 2 start docs! Open for contributions.
http://tessel.io/start
35 stars 31 forks source link

Environment config support? #171

Open danawoodman opened 6 years ago

danawoodman commented 6 years ago

I am trying to use environment configs to allow me to develop, test and deploy to my Tessel without hardcoding API keys etc.

I have attempted to use node-config as well as dotenv and while both work great in my Jest test suite and in development, the configs don't work on the Tessel. I have added my .env file to .tesselinclude and triple checked everything but nothing is working.

Are environment configs support on Tessel's VM/OS? If so, what am I missing?

Thanks!

danawoodman commented 6 years ago

@Frijol @HipsterBrown any suggestions?

rwaldron commented 6 years ago

I've never tried deploying with a .env file, but my guess is that dotenv is looking in the wrong place: https://github.com/motdotla/dotenv#path, try this:

require('dotenv').config({path: path.join(__dirname, '.env')});
danawoodman commented 6 years ago

@rwaldron thanks I'll give this a shot and report back!

ivan-marquez commented 6 years ago

Hi @danawoodman! Did you manage to make it work by specifying the path with __dirname? I'm stuck with the same issue. Thanks!

ivan-marquez commented 6 years ago

ok just to confirm, specifying the path works. Thanks!!!