File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed
Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change 11{
2- "serviceName" : " laobri " ,
3- "api-key " : " abcd "
2+ "serviceName" : " [SEARCH_SERVICE_NAME] " ,
3+ "apiKey " : " [SEARCH_SERVICE_API_KEY] "
44}
Original file line number Diff line number Diff line change 11#!/usr/bin/env/node
22
33const 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
813const 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
You can’t perform that action at this time.
0 commit comments