Skip to content

Process values on initialization #21

@codev0

Description

@codev0

Hi there,

In my case I need to decode values of env variables through symmetric encryption, cause store passwords in open kind is bad in other side we can't use vault or other secret storage yet (inner infrastructure doesn't ready), so we pass the password from outsite.

Example:

// .env.production
DB_PASSWORD=ENV(96b69e27a5b662b0b98222a424485a35 ) // encrypted
// main.js
const dotenvFlow = require('dotenv-flow');
const decode = requre('decode');

const password = process.env.DOCKER_ENV_PASSWORD // Passed from outside

dotenvFlow.config({
  process: function(key, value) {
    return {
      key: decode(value.match(/\((.*)\)/).pop(), password);
    }
  }
});

What about this feature? Does it possible to do PR?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions