question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Custom env file name

See original GitHub issue

Hello, as written in docs:

Note: By default the package look for a .env file in the path that you have started your server from. If you want to specify another path for your .env file, use the second parameter of ConfigModule.load().

I’d like to set different .env file for Test module. When i’m doing

ConfigModule.load(
  path.resolve(__dirname, 'config/*.{ts,js}'),
    {
      path: 'mypath/.env.test',
    }
)

I’m getting

error TS2345: Argument of type ‘{ path: string; }’ is not assignable to parameter of type ‘ConfigOptions’.

So, how should options parameter looks like?

Also is there a possibility, to extend in .env.test file values from default .env file, so wouldn’t i have to duplicate code?

Thanks

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
radziszpcommented, Jan 28, 2019

👍 Thanks!

0reactions
Dilukacommented, Feb 1, 2019

emmmm it works now. just filename. ┓( ´∀` )┏

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to customize Node.js .env files for different environment ...
By default, custom-env picks the .env file for your dev stage. However, to customize for a different stage, add the name as a...
Read more >
Customizing Node.js .env files - LogRocket Blog
Learn how to configure a Node.js application via environment variables and customize an .env file with new environment variables.
Read more >
optionally change the file name of ".env" · Issue #20 - GitHub
I would like to the ability to optionally override the file which you load env. _loadEnv: function(fileName) { if (!
Read more >
node.js - Naming convention for environment variables files?
I was just wondering if there was any standardized convention for .env environment variable files. If I had ...
Read more >
How To Deal With Custom .env Files in Next.js
First, create a build.sh file in the root directory of your project as follows: Here, .env.local is removed and .env.production is replaced by ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found