Skip to content

Commit e7a2612

Browse files
committed
Support for env var driven browserstack.json
1 parent eccf5c4 commit e7a2612

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,21 @@ A sample configuration file:
8888
}
8989

9090

91+
### Enviroment variables
92+
93+
* `BROWSERSTACK_USER`:
94+
BrowserStack user name.
95+
96+
* `BROWSERSTACK_KEY`:
97+
BrowserStack key.
98+
99+
* `TUNNEL_ID`:
100+
Identifier for the current instance of the tunnel process. In `TRAVIS` setup `TRAVIS_JOB_ID` will be the default identifier.
101+
102+
* `BROWSERSTACK_JSON`:
103+
Path to the browserstack.json file. If null, `browserstack.json` in the root directory will be used.
104+
105+
91106
### Secure Information
92107

93108
To prevent checking in the BrowserStack `username` and `key` in your

lib/config.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@ var path = require('path'),
22
fs = require('fs');
33
var pwd = process.cwd();
44

5+
config_path = process.env.BROWSERSTACK_JSON || 'browserstack.json';
6+
config_path = path.resolve(path.relative(process.cwd(), config_path));
7+
console.log("Using config:", config_path);
8+
59
try {
6-
var config = require(process.cwd() + '/browserstack');
10+
var config = require(config_path);
711
} catch (e) {
812
if (e.code == 'MODULE_NOT_FOUND') {
913
console.log('Configuration file `browserstack.json` is missing.');

0 commit comments

Comments
 (0)