Skip to content
This repository was archived by the owner on Jul 17, 2020. It is now read-only.

Commit 4e1dcd3

Browse files
committed
Implement external config file
1 parent 307bd07 commit 4e1dcd3

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,6 @@
33
node_modules/
44
data/
55
*.jar
6+
7+
// ignore local config files; only commit ones with .SAMPLE
8+
*.config.json

run-headless.config.json.SAMPLE

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"email": "you can guess",
3+
"password": "what these are",
4+
5+
"siteUrl": "https://stackoverflow.com",
6+
"roomUrl": "https://chat.stackoverflow.com/rooms/1"
7+
}

run-headless.js

+3-9
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,12 @@
11
var Nightmare = require('nightmare'),
2-
readline = require('readline');
2+
readline = require('readline'),
3+
fs = require('fs');
34

45
var hound = new Nightmare({
56
cookiesFile: 'cookies.jar'
67
});
78

8-
/*********** Change me! ***********/
9-
var config = {
10-
email: 'you can guess',
11-
password: 'what these are',
12-
13-
siteUrl: 'https://stackoverflow.com',
14-
roomUrl: 'https://chat.stackoverflow.com/rooms/1'
15-
};
9+
var config = JSON.parse(fs.readFileSync('run-headless.config.json', 'utf8'));
1610

1711
function once (fn) {
1812
var called = false, res;

0 commit comments

Comments
 (0)