DenoDDeno
Powered by
isoI
Denoβ€’13mo agoβ€’
9 replies
iso

Deno env vars

In a Deno/Fresh app I have a config file that provides access to env vars, however when I try to run my migrations via

 deno run --env-file=.env db:migrate:latest
 deno run --env-file=.env db:migrate:latest


which in the deno.json file runs
kysely migrate:latest
kysely migrate:latest


I am told that
Deno is not defined
Deno is not defined
. Is this due to Kysley being a node based lib?

How can I make this work?


export const config: Config = {
    db: {
        host: Deno.env.get('DB_HOST'),
        user: Deno.env.get('DB_USER'),
        password: Deno.env.get('DB_PASSWORD'),
        database: Deno.env.get('DB_NAME'),
        port: parseInt(Deno.env.get('DB_PORT')),
        pool: parseInt(Deno.env.get('DB_POOL_SIZE'))
    }
}
export const config: Config = {
    db: {
        host: Deno.env.get('DB_HOST'),
        user: Deno.env.get('DB_USER'),
        password: Deno.env.get('DB_PASSWORD'),
        database: Deno.env.get('DB_NAME'),
        port: parseInt(Deno.env.get('DB_PORT')),
        pool: parseInt(Deno.env.get('DB_POOL_SIZE'))
    }
}
Deno banner
DenoJoin
Chat about Deno, a modern runtime for JavaScript and TypeScript.
20,934Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

env vars interpolation across multiple --env-file
KasperKKasper / help
16mo ago
Deno.env via file
Long ZerLLong Zer / help
3y ago
Referencing environment variables from .env in deno compile or deno task commands
TommyTTommy / help
17mo ago