Skip to content

Commit 5092948

Browse files
committed
Using nconf, I think
1 parent 467ba40 commit 5092948

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"serviceName" : "laobri",
3+
"api-key" : "abcd"
4+
}

quickstart/index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
#!/usr/bin/env/node
22

3+
const nconf = require('nconf')
4+
const config = nconf.file({ file: "config.json" });
5+
6+
console.log(config.get("serviceName"));
7+
38
const run = async() => {
49
console.log("Hello, Node from CLI");
10+
511
}
612

713
run();

quickstart/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
"type": "git",
1111
"url": "."
1212
},
13+
"dependencies": {
14+
"nconf": "^0.9.0"
15+
},
1316
"author": "Larry O'Brien",
1417
"license": "MIT"
1518
}

0 commit comments

Comments
 (0)