Skip to content

Commit 9bad524

Browse files
committed
Basic search config
1 parent 642b892 commit 9bad524

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"serviceName" : "laobri",
3-
"api-key" : "abcd"
2+
"serviceName" : "[SEARCH_SERVICE_NAME]",
3+
"apiKey" : "[SEARCH_SERVICE_API_KEY]"
44
}

quickstart/index.js

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

33
const nconf = require('nconf')
4-
const config = nconf.file({ file: "config.json" });
54

6-
console.log(config.get("serviceName"));
5+
function getAzureConfiguration() {
6+
const config = nconf.file({ file: 'azure_search_config.json' });
7+
if (config.get('serviceName') == '[SEARCH_SERVICE_NAME' || config.get('apiKey') == '[SEARCH_SERVICE_API_KEY]') {
8+
throw "You have not set the values in your azure_search_config.json file. Please change them to match your search service's values."
9+
}
10+
return config;
11+
}
712

813
const run = async() => {
14+
try {
15+
const cfg = getAzureConfiguration();
916
console.log("Hello, Node from CLI");
17+
} catch (x) {
18+
console.log(x);
19+
}
1020

1121
}
1222

0 commit comments

Comments
 (0)