Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjusts in envs #6

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Nexmo api key
NEXMO_API_KEY=xxxxxxx

# Nexmo secret key
NEXMO_API_SECRET=xxxxx

# Port for running node
PORT=5000

# Proxy number is the one to receive the call
PROXY_TO_NUMBER=9999999
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ nexmo app:create demo-app --keyfile private.key http://example.com http://exampl
Rename the config file:

```sh
mv example.env .env
mv .env.example .env
```

Fill in the values in `.env` as appropriate.
Expand Down
12 changes: 6 additions & 6 deletions config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
require('dotenv').config();

var config = {
nexmoApiKey: process.env['NEXMO_API_KEY'],
nexmoApiSecret: process.env['NEXMO_API_SECRET'],
applicationId: process.env['APP_UUID'],
proxyToNumber: process.env['PROXY_TO_NUMBER'],
port: process.env['PORT'] || 5000
const config = {
nexmoApiKey: process.env.NEXMO_API_KEY,
nexmoApiSecret: process.env.NEXMO_API_SECRET,
applicationId: process.env.APP_UUID,
proxyToNumber: process.env.PROXY_TO_NUMBER,
port: process.env.PORT || 5000
};

module.exports = config;
2 changes: 0 additions & 2 deletions example.env

This file was deleted.

2 changes: 1 addition & 1 deletion lib/server.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var app = require('express')();
var config = require('../config');

app.set('port', (config.port || 5000));
app.set('port', config.port);
app.use(require('body-parser').json());

app.listen(app.get('port'), function() {
Expand Down