Skip to content

Commit

Permalink
Use API key from environment or config file
Browse files Browse the repository at this point in the history
  • Loading branch information
tadman committed Nov 7, 2016
1 parent 2c59c9d commit 3696f33
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion test/config/test.json.example
@@ -1,3 +1,3 @@
{
"apikey": "YOUR_API_KEY_HERE"
"apiKey": "YOUR_API_KEY_HERE"
}
12 changes: 10 additions & 2 deletions test/postageapp.js
@@ -1,7 +1,15 @@
var fs = require('fs');
var assert = require('chai').assert;

var settings = require('./config/test.json');
var postageapp = require('../lib/postageapp')(settings.apikey);
var apiKey = process.env.POSTAGEAPP_API_KEY;

if (!apiKey) {
var settings = require('./config/test.json');

apiKey = settings.apiKey;
}

var postageapp = require('../lib/postageapp')(apiKey);

describe('postageapp', function () {
this.timeout(5000);
Expand Down

0 comments on commit 3696f33

Please sign in to comment.