Skip to content
Permalink
Browse files

Add dotenv support. (#72)

* Add dotenv support.

Now one can use a .env file in the project root with the needed environment variables.
If the environment variables are already set, they take precedence.
  • Loading branch information
XhmikosR authored and emedvedev committed Nov 27, 2019
1 parent b9038a0 commit 287cd1ada4d852c3895005ed7541b6691c80d318
Showing with 29 additions and 0 deletions.
  1. +11 −0 .env.template
  2. +2 −0 .gitignore
  3. +2 −0 bin/slackin
  4. +5 −0 package-lock.json
  5. +1 −0 package.json
  6. +8 −0 readme.md
@@ -0,0 +1,11 @@
SLACK_SUBDOMAIN=
SLACK_API_TOKEN=
RECAPTCHA_SECRET=
RECAPTCHA_SITEKEY=
RECAPTCHA_INVISIBLE=
SLACKIN_COC=
SLACKIN_CHANNELS=
SLACKIN_INTERVAL=
SLACKIN_ANALYTICS=
SLACKIN_THEME=
SLACKIN_ACCENT=
@@ -8,3 +8,5 @@ node_modules

# logs
npm-debug.log

/.env
@@ -5,6 +5,8 @@ const hostenv = require('hostenv');
const dbg = require('debug');
const slackin = require('../lib');

require('dotenv').config()

const mainLog = dbg('slackin:main');

args

Some generated files are not rendered by default. Learn more.

@@ -22,6 +22,7 @@
"cors": "^2.8.5",
"cross-env": "^6.0.3",
"debug": "^4.1.1",
"dotenv": "^8.2.0",
"email-regex": "^4.0.0",
"express": "^4.17.1",
"hostenv": "^2.0.0",
@@ -90,6 +90,14 @@ Every CLI parameter, including mandatory arguments (workspace ID and token), can
| | | `SLACKIN_HTTPS_REDIRECT` | `''` | If a domain name is specified in this parameter and `SLACKIN_PROXY` is set to `true`, Slackin will redirect requests with `x-forwarded-proto === 'http'` to `https://<SLACKIN_HTTPS_REDIRECT>/<original URL>` |
| | | `SLACKIN_LETSENCRYPT` | `''` | [Let's Encrypt](https://letsencrypt.org/) challenge response |

Alternatively, you can specify the configuration parameters in a [dotenv file](https://github.com/motdotla/dotenv): create a `.env` file in the root directory of your project and add environment-specific variables on new lines in the form of NAME=VALUE. For example:

```
SLACK_SUBDOMAIN=mysubdomain
SLACK_API_TOKEN=SLACK-API-TOKEN
SLACKIN_THEME=dark
```

## Extras

### Tips and tricks

0 comments on commit 287cd1a

Please sign in to comment.
You can’t perform that action at this time.