Skip to content

Conversation

@fnavarijo
Copy link

@fnavarijo fnavarijo commented Apr 10, 2020

Update: Adding top-level configuration module support

This update let users to configure keys via top-level options.
I think this enhancement let users organize in a better way the env keys that will be injecting to the project. I only added this enhancement, the behavior to inject via env prop and module options keeps the same Here is an example

module.exports = {
  env: {
    SOME_COOL_ENV: 'cool value',
  },
  modules: [
    ['nuxt-env', {
        keys: [
            'TEST_ENV_VAR', // Basic usage—equivalent of { key: 'TEST_ENV_VAR' }
            { key: 'OTHER_ENV_VAR', default: 'defaultValue' } // Specify a default value
            { key: 'THIRD_ENV_VAR', secret: true } // Only inject the var server side
            { key: 'ANOTHER_ENV_VAR', name: 'MY_ENV_VAR' } // Rename the variable
        ]
    }]
  ],
  // Now we can configure the keys this way too
  nuxtenv: {
    keys: [
        'TEST_ENV_VAR', // Basic usage—equivalent of { key: 'TEST_ENV_VAR' }
        { key: 'OTHER_ENV_VAR', default: 'defaultValue' } // Specify a default value
        { key: 'THIRD_ENV_VAR', secret: true } // Only inject the var server side
        { key: 'ANOTHER_ENV_VAR', name: 'MY_ENV_VAR' } // Rename the variable
    ]
  }
};

Any suggestion or correction you think must be made, let met know to do it.

Thanks for this awesome project.

PD. I also updated circle pipeline definition to use npm.

Copy link
Owner

@samtgarson samtgarson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for your contribution. I will release this in a new version shortly.

@lefuturiste
Copy link

Thanks for this PR, I'm hoping this will get merged and released soon because this can be really usefull.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants