Skip to content

Instantly share code, notes, and snippets.

@colibie
Created December 10, 2019 12:02
Show Gist options
  • Save colibie/ea839e647f7f873b9920d279c946cd4c to your computer and use it in GitHub Desktop.
Save colibie/ea839e647f7f873b9920d279c946cd4c to your computer and use it in GitHub Desktop.
A gist that contains the setup configuration for text anaytics api
const key_var = 'TEXT_ANALYTICS_SUBSCRIPTION_KEY';
if (!process.env[key_var] && !config[key_var]) {
throw new Error('please set/export the following environment variable: ' + key_var);
}
const subscription_key = process.env[key_var] || config[key_var];
const endpoint_var = 'TEXT_ANALYTICS_ENDPOINT';
if (!process.env[endpoint_var] && !config[endpoint_var]) {
throw new Error('please set/export the following environment variable: ' + endpoint_var);
}
const endpoint = process.env[endpoint_var] || config[endpoint_var];
let pathForLanguages = '/v2.1/languages';
let pathForSentiments = '/v2.1/sentiment';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment