File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed
Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,25 @@ function TestingBot(options) {
88 this . options = options || { } ;
99 this . options . api_key = process . env . TESTINGBOT_KEY || this . options . api_key || null ;
1010 this . options . api_secret = process . env . TESTINGBOT_SECRET || this . options . api_secret || null ;
11+
12+ if ( ! this . options . api_key || ! this . options . api_secret ) {
13+ var fs = require ( 'fs' ) ;
14+ var path = require ( 'path' ) ;
15+
16+ try {
17+ var tbFile = path . join ( process . env [ ( process . platform == 'win32' ) ? 'USERPROFILE' : 'HOME' ] , '.testingbot' ) ;
18+ if ( fs . statSync ( tbFile ) . isFile ( ) === true ) {
19+ var data = fs . readFileSync ( tbFile ) ;
20+ if ( data !== null ) {
21+ var arr = data . toString ( ) . replace ( '\n' , '' ) . split ( ':' ) ;
22+ this . options . api_key = arr [ 0 ] ;
23+ this . options . api_secret = arr [ 1 ] ;
24+ }
25+ }
26+ } catch ( e ) {
27+
28+ }
29+ }
1130}
1231
1332TestingBot . prototype . getTestDetails = function ( testID , callback ) {
Original file line number Diff line number Diff line change 22 "author" :
" TestingBot <[email protected] > (testingbot.com)" ,
33 "name" : " testingbot-api" ,
44 "description" : " A wrapper around TestingBot's REST API" ,
5- "version" : " 1.0.0 " ,
5+ "version" : " 1.0.1 " ,
66 "homepage" : " https://github.com/testingbot/testingbot-api" ,
77 "repository" : {
88 "type" : " git" ,
You can’t perform that action at this time.
0 commit comments