# haraka-plugin-secrets-manager
A Haraka plugin for parsing config files with EJS to inject environment variables into config files on initialize

## Install

Install with npm
```bash
npm install @mailprotector/haraka-plugin-secrets-manager --save
```

## Setup
### Enable Plugin
Add to `plugin` file in the haraka config folder
```text
@mailprotector/haraka-plugin-secrets-manager
```

### Setup Secrets
When Haraka initializes it loads your passed in config folder and parses each config file using EJS, passing in process.env as the model.
This allows us to set configuration files through environment variables on init, instead of keeping configs in plaintext on github.
Create an environment variable called CONFIG_PATH and set it to your absolute haraka config folder path.

### Example
```js
  process.env.CONFIG_PATH = '/etc/haraka/config
  process.env.TESTING = 'truth'
```

your_plugin_config.json
```json
{
  "eats_cake": "<%= TESTING %>"
}
```

will produce:
```json
{
  "eats_cake": "truth"
}
```
##
![alt text](https://i1.wp.com/mailprotector.com/wp-content/uploads/2020/03/cropped-logo-2x.png)
[About Mailprotector](https://mailprotector.com/about-mailprotector)
