Giter VIP home page Giter VIP logo

dotenv-module's People

Contributors

4aficiona2 avatar adekoyejoakinhanmi avatar atinux avatar benweatherman avatar danielroe avatar decipher avatar dependabot[bot] avatar husayt avatar ilharp avatar julientant avatar matyunya avatar rchl avatar renovate[bot] avatar ricardogobbosouza avatar xerosanyam avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

dotenv-module's Issues

fs dependency not found

I've follow the instructions to add the dotenv module.
When I run npm run dev I'm getting the following error:

This dependency was not found:

  • fs in ./node_modules/@nuxtjs/dotenv/dist/index.js

To install it, you can run: npm install --save fs

Digging into this npm package its seems to be a security-holder package.
How to solve the error?

This question is available on Nuxt.js community (#c11)

Empty only option array should result in nothing going into context.env

What problem does this feature solve?

Currently, if the only option is specified with an empty array, default logic is used and all values are placed into context.env and thus provided to the client.

I think that an empty array should signal that I do not want anything copied into context.env. If I do not specify an only option/array at all, I would expect the default behavior to apply and all values would be placed into context.env.

As a workaround, I specify a name in the array that doesn't correspond to any key:

['@nuxtjs/dotenv', { only: ['nothing'] }],

Related, I agree with this comment on #7 that there should be a warning that all values are available on the client unless only is used.

What does the proposed changes look like?

This configuration

['@nuxtjs/dotenv', { only: [] }],

results in nothing in .env going into context.env.

This feature request is available on Nuxt community (#c22)

Can you please update

Hello @JulienTant,
This is release in code since months (3e26963)

but not on npm… (dist folder is not up to date) "version": "1.1.1"

{
  modules: [
    ['@nuxtjs/dotenv', { filename: '.env.prod' }],
  ]
}

Could you please update repositories.

Regards

This question is available on Nuxt community (#c16)

Hot reload if .env file changes are happening

Hot reloading is not working if you do a simple change on your .env file.

Steps to reproduce:

  1. Start dev server (e.g. with npm run dev or yarn run dev)
  2. Change something in your .env file
This question is available on Nuxt.js community (#c3)

is it possible to load values from multiple .env files (example .env + .env.development + .env.development.local)

I'm coming to nuxt from vue-cli and vue-cli has a way of loading multiple .env files which I found very logical and convenient

See docs here: https://cli.vuejs.org/guide/mode-and-env.html#environment-variables

And image explaining the gist of it:
Screen Shot 2020-07-10 at 5 38 19 PM

I would like to do the same with nuxt now... so .env would always be loaded, then depending on the environment (dev, staging, production) it would optionally also load .env.[environment]

And furthermore it could also load .env.local and .env.[environment].local (.local files are by default ignored by .git)

The .local bit is not so crucial but the ability to load .env + .env.[environment] I found very useful. Of course any values in .env.[environment] would overwrite any identical values in .env

Can I achieve this with nuxt's dotenv-module?

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Repository problems

These problems occurred while renovating this repository. View logs.

  • WARN: Using npm packages for Renovate presets is now deprecated. Please migrate to repository-based presets instead.

Warning

These dependencies are deprecated:

Datasource Name Replacement PR?
npm @nuxtjs/module-test-utils Unavailable
npm codecov Unavailable
npm standard-version Available

Edited/Blocked

These updates have been manually edited so Renovate will no longer make changes. To discard all commits and start over, click on a checkbox.

Other Branches

These updates are pending. To force PRs open, click the checkbox below.

  • chore(deps): replace devdependency standard-version with commit-and-tag-version ^9.5.0

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/ci.yaml
  • actions/checkout v4
  • actions/setup-node v4
npm
package.json
  • consola ^3.2.3
  • dotenv ^8.2.0
  • @commitlint/cli ^18.4.2
  • @commitlint/config-conventional ^18.4.2
  • @nuxtjs/eslint-config ^12.0.0
  • @nuxtjs/module-test-utils ^1.6.3
  • @types/jest ^29.5.8
  • codecov ^3.8.3
  • eslint ^8.53.0
  • eslint-plugin-jest ^27.6.0
  • husky ^8.0.3
  • jest ^29.7.0
  • nuxt-edge ^2.17.2-28284499.5674f49
  • standard-version ^9.5.0

  • Check this box to trigger a request for Renovate to run again on this repository

Allow path to .env to be overridden.

Currently this module expects that the .env file to live in the root of the NuxtJS project. I have a usecase where I wish for the .env file to live in another location so it can be shared among multiple projects.

As such, it would be ideal if the module accepted a path option.

PR incoming.

This question is available on Nuxt.js community (#c8)

.env.dev file is not working in nuxt plugin

Hello.

.env.dev file is not working in nuxt plugin.

i created .env.dev file and run script "nuxt --dotenv .env.dev".
print env variable in my custom nuxt plugin.
console.log(process.env) #output :: {}

But .env file is working.

Cannot add private key

i have try :
private_key="-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAAS....."
or
private_key:-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAAS...
or
private_key:'-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAAS....'

but result is Certificate object must contain a string "private_key" property.

This question is available on Nuxt.js community (#c6)

Run CircleCI on PRs

What problem does this feature solve?

Run CircleCI on PRs

This feature request is available on Nuxt community (#c27)

Use system process if .env file is not found

In our team, we would like to use .env file for local development. But it won't be committed to git. And while deploying it will take env variables from server. Right now when I add .env to .gitignore and when I try to build it from where, it throws an error saying that .env file is not found

This question is available on Nuxt.js community (#c5)

nuxt3 support?

Thanks a lot for those remarkable jobs you've done!

Just wander if there is a plan for nuxt3?

(just have a try on nuxt3: not work but without any errors in both console and terminal)

variables not defined on init

the environment variables are not defined at the beginning. I am using the nuxtjs / axios module where I configure:

baseURL: process.env.API_URL,
browserBaseURL: process.env.API_URL_BROWSER

with this config an error occurs:

TypeError: Cannot read property 'substr' of undefined
    at ModuleContainer.nuxtAxios (/home/javier/vms/twobvm/projects/cominghouse/node_modules/@nuxtjs/axios/lib/index.js:38:46)

thank you!

This question is available on Nuxt.js community (#c2)

Variable composition doesn't work

Version

v1.4.0

Reproduction link

http://there-is-no-link

Steps to reproduce

VUE_APP_A=A
VUE_APP_AB=$VUE_APP_A/B

What is expected ?

VUE_APP_A=A
VUE_APP_AB=A/B

What is actually happening?

VUE_APP_A=A
VUE_APP_AB=$VUE_APP_A/B

Additional comments?

This works fine in vue-cli SPA, but doesn't work in nuxt. I assume they both use the same library, but nuxt is missing something.

This bug report is available on Nuxt community (#c32)

Nuxt dotenv-module and deploying to Netlify

Version

1.3.0

Reproduction link

https://github.com/beardedpayton/paytonburdette.com-v2

Steps to reproduce

Install module

npm i nuxtjs/dotenv

** cant include the @ symbol here, it thinks I'm trying to tag a user in the issue

Require module in nuxt.config.js

require('dotenv').config()

Add module to modules array in nuxt.config.js

modules: ["@nuxtjs/dotenv"]

Use "module in codebase with process.env.ENV_VAR_NAME

What is expected ?

Works as expected locally. I can read from my .env file fine.

When deploying to Netlify and using build environment variables, I should be able to read from those variables within my project.

What is actually happening?

I cannot read variables from my build environment variables established with Netlify. I can only read from them if a .env file is present.

This bug report is available on Nuxt community (#c20)

is it working with nuxt / express ?

Hello,

Sorry to interrupt here but I really can not manage to achieve a simple thing (read process.env)

#1 - Only way I can read what's in my .env file is by
require('dotenv').config()
in nuxt.config.js

When I'm adding it as a module, it doesn't find anything even if .env is at the root...

#2 still in nuxt.config.js I define :

 env: {
    test: process.env.TEST,
  },

#3
In server/index.js I define :

const test = process.env.test

And it's always undefined...

I've tried a lot and a lot of thing but I think I'm missing something here. Any help will be really appreciate !

thanks !

This question is available on Nuxt.js community (#c10)

Env vars are empty after module install

Version

1.3.0

Reproduction link

http://no.link

Steps to reproduce

  1. yarn add @nuxtjs/dotenv
  2. edit nuxt.config.js (modules property): https://pastebin.com/13Btdxyt
  3. add some var to .env like this: SOMEKEY=SOME_KEY_VALUE
  4. try to output value of process.env: https://pastebin.com/K4HAAuJq

What is expected ?

output of .env file vars array

What is actually happening?

empty object "{}"

nuxt version "nuxt": "^2.0.0",

This bug report is available on Nuxt community (#c21)

System vars should overwrite dotenv vars

What problem does this feature solve?

In most places where dotenv is used system env vars override the dotenv vars, however dotenv-module does the exact opposite, swapping this around would give the expected result when using systemvars: true

This feature request is available on Nuxt community (#c28)

Problem with transpiled file related to systemvars

Version

v1.3.0

Reproduction link

https://couldnt-get-codesandbox-to-work

Steps to reproduce

I'm using yarn 1.17.3 and dotenv-module 1.3.0. (problem also occurs on npm)

Install those and try using systemvars: true. No vars will be loaded.

What is expected ?

This is what I get when building the dist/index.js file myself, which is OK:

  if (options.systemvars) {
    Object.keys(process.env).map(function (key) {
      if (!(key in envConfig)) {
        envConfig[key] = process.env[key];
      }
    });
  }

What is actually happening?

But this is what I get when installing the package:

  if (options.systemvars) {
    Object.keys(process.env).map(function (key) {
      if (!key in envConfig) {
        envConfig[key] = process.env[key];
      }
    });
  }

The condition always returns false and no vars are loaded.

This bug report is available on Nuxt community (#c26)

Can't deploy to Netlify when using @Nuxt/dotenv

Hello!

I've been unable to deploy to Netlify when using the plugin.

  • "@nuxtjs/dotenv": "^1.1.0"
  • "nuxt": "^1.0.0"
modules: [
        ['@nuxtjs/dotenv']
]

Netlfiy Error log when using the module
Netfliy log for successful deployment

I've tried a whole bunch of different configurations inside nuxt.config.js but could'nt get anything to work. I don't get the issue when I generate the static site locally just when using Netlify. I have spoke to their support and they can't see the issue. I am wondering if its to do with the NPM WARN about missing optional dependencies? Let me know if you need anymore info!

This question is available on Nuxt.js community (#c7)

Action required: Greenkeeper could not be activated 🚨

🚨 You need to enable Continuous Integration on all branches of this repository. 🚨

To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because we are using your CI build statuses to figure out when to notify you about breaking changes.

Since we did not receive a CI status on the greenkeeper/initial branch, we assume that you still need to configure it.

If you have already set up a CI for this repository, you might need to check your configuration. Make sure it will run on all new branches. If you don’t want it to run on every branch, you can whitelist branches starting with greenkeeper/.

We recommend using Travis CI, but Greenkeeper will work with every other CI service as well.

Once you have installed CI on this repository, you’ll need to re-trigger Greenkeeper’s initial Pull Request. To do this, please delete the greenkeeper/initial branch in this repository, and then remove and re-add this repository to the Greenkeeper integration’s white list on Github. You'll find this list on your repo or organization’s settings page, under Installed GitHub Apps.

This question is available on Nuxt.js community (#c1)

Nuxt dotenv options require in nuxt-config.js doesn't work

Hi,

I tried to use nuxt-dotenv with fileaname custom options like that:

modules: [
    ['@nuxtjs/dotenv', {
      filename: '.env.dev',
  }],
  ],

It's working fine in my app but not in my nuxt-config.js
I import dotenv at the top:

require('dotenv').config()

Before that I had to add the dotenv dependency to my package.json.
But the custom .env file wasn't read. Only .env is working.

This question is available on Nuxt community (#c19)

Add support for Nuxt3

Is there also support for nuxt3?

I don't think the default nuxt3 way is very convenient because it also requires modifying nuxt.config.ts when the env variables are required on the client side.

'only' option not working as expected: removes variables both from process + context

Version

v1.4.0

Reproduction link

https://codesandbox.io/s/awesome-sanderson-vijy1

Steps to reproduce

  1. Visit reproduction link provided
  2. Reload home route '/'
  3. Check server log in Terminal
  4. toggle routes '/about' <> '/'
  5. Check client log in Console

What is expected ?

console.log server Terminal

/home | fetch() | from server
/home | fetch() | process.env.TEST1 TEST1
/home | fetch() | context.env.TEST1 undefined
/home | fetch() | process.env.TEST2 TEST2
/home | fetch() | context.env.TEST2 TEST2
/home | fetch() | process.env.TEST3 undefined
/home | fetch() | context.env.TEST3 undefined

console.log client Console (toggle route '/about' <> '/')

/home | fetch() | from client
/home | fetch() | process.env.TEST1 undefined
/home | fetch() | context.env.TEST1 undefined
/home | fetch() | process.env.TEST2 TEST2
/home | fetch() | context.env.TEST2 TEST2
/home | fetch() | process.env.TEST3 undefined
/home | fetch() | context.env.TEST3 undefined

What is actually happening?

console.log server Terminal

/home | fetch() | from server
/home | fetch() | process.env.TEST1 undefined
/home | fetch() | context.env.TEST1 undefined
/home | fetch() | process.env.TEST2 TEST2
/home | fetch() | context.env.TEST2 TEST2
/home | fetch() | process.env.TEST3 undefined
/home | fetch() | context.env.TEST3 undefined

console.log client Console (toggle route '/about' <> '/')

/home | fetch() | from client
/home | fetch() | process.env.TEST1 undefined
/home | fetch() | context.env.TEST1 undefined
/home | fetch() | process.env.TEST2 TEST2
/home | fetch() | context.env.TEST2 TEST2
/home | fetch() | process.env.TEST3 undefined
/home | fetch() | context.env.TEST3 undefined

Additional comments?

I'd expect to have control over environment variables visibility via 'only' option.

E.g. with .env file

STRIPE_SECRET_KEY="1234"
STRIPE_PUBLISHABLE_KEY="9876"

and configuring ['@nuxtjs/dotenv', { only: ['STRIPE_PUBLISHABLE_KEY'] }]
both variables should be available server-side - while client-side only STRIPE_PUBLISHABLE_KEY should be accessible.

This bug report is available on Nuxt community (#c33)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.