Anyone had any luck using environment variables (p...
# prisma-whats-new
h
Anyone had any luck using environment variables (perhaps with the
dotenv
package) in the graphcool-framework v11.5? It seems to have been implemented in Prisma, but can’t get it to work in GCF, and the issues/docs are somewhat confusing and mixing the two up 🙂
m
@halborg I've been using direnv with the framework
h
How? I have dotenv 5.0.0, and a
.env.dev
and a
.env.prod
file in the root of my project. One of the values are
AUTH_TOKEN_ENDPOINT="https://..."
, and I try deploying by doing
graphcool deploy --env-file .env.dev
. This gives me an error saying
A valid environment variable to satisfy the declaration 'env:AUTH_TOKEN_ENDPOINT' could not be found.
- can you spot my mistake @max ?
m
@halborg I don't use dotenv.....I use direnv (). This is how I reference env vars in the graphcool.yml file: MAILGUN_API_KEY: ${env:MAILGUN_API_KEY}
h
Oh, I see - thanks! 🙂 I’ll give it a go
But using direnv, @max, how do you hold variables for prod and dev? As I understand it, it only allows for a single file?
And what args do you use when deploying? Can’t seem to find anything about it
m
I've been using
eval "$(direnv export bash)"
with macOS. I only have one .envrc file...so not sure how to help you with dev v.s. prod