Skip to content

Commit

Permalink
Add and configure Braintree api credentials
Browse files Browse the repository at this point in the history
  • Loading branch information
braintreeps committed Nov 10, 2015
1 parent bb7eb52 commit 2c23eef
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,3 +1,4 @@
node_modules/

*.log
.env
11 changes: 11 additions & 0 deletions app.js
Expand Up @@ -4,12 +4,23 @@ var favicon = require('serve-favicon');
var logger = require('morgan');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
var braintree = require('braintree');

var routes = require('./routes/index');
var users = require('./routes/users');

var app = express();

require('dotenv').load();

// configure Braintree environment
var gateway = braintree.connect({
environment: braintree.Environment[process.env.BT_ENVIRONMENT],
merchantId: process.env.BT_MERCHANT_ID,
publicKey: process.env.BT_PUBLIC_KEY,
privateKey: process.env.BT_PRIVATE_KEY,
});

// view engine setup
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'jade');
Expand Down
4 changes: 4 additions & 0 deletions example.env
@@ -0,0 +1,4 @@
BT_ENVIRONMENT='Sandbox'
BT_MERCHANT_ID='your braintree merchant id'
BT_PUBLIC_KEY='your braintree public key'
BT_PRIVATE_KEY='your braintree private key'
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -19,7 +19,8 @@
"jade": "~1.11.0",
"morgan": "~1.6.1",
"serve-favicon": "~2.3.0",
"braintree": "1.30.0"
"braintree": "1.30.0",
"dotenv": "1.2.0"
},
"engines": {
"node": "4.2.2"
Expand Down

0 comments on commit 2c23eef

Please sign in to comment.