aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Wilkins <samwilkins333@gmail.com>2019-11-10 14:59:49 -0500
committerSam Wilkins <samwilkins333@gmail.com>2019-11-10 14:59:49 -0500
commit63ea273820eb5ab8388e2744fc7988f10746f25f (patch)
treeea23a6e201316f83d25ad3ad62dec8ed9ba254d7
parent36ad83493d2bd58dc6fe62df6002789ccc1b06a1 (diff)
now using environment variable route
-rw-r--r--src/client/cognitive_services/CognitiveServices.ts2
-rw-r--r--src/server/index.ts15
2 files changed, 1 insertions, 16 deletions
diff --git a/src/client/cognitive_services/CognitiveServices.ts b/src/client/cognitive_services/CognitiveServices.ts
index af5fb39fc..e74aef998 100644
--- a/src/client/cognitive_services/CognitiveServices.ts
+++ b/src/client/cognitive_services/CognitiveServices.ts
@@ -38,7 +38,7 @@ export enum Confidence {
export namespace CognitiveServices {
const ExecuteQuery = async <D>(service: Service, manager: APIManager<D>, data: D): Promise<any> => {
- return fetch(Utils.prepend(`cognitiveServices/${service}`)).then(async response => {
+ return fetch(Utils.prepend(`environment/${service}`)).then(async response => {
let apiKey = await response.text();
if (!apiKey) {
console.log(`No API key found for ${service}: ensure index.ts has access to a .env file in your root directory`);
diff --git a/src/server/index.ts b/src/server/index.ts
index 8fc402cc9..d68e9faa1 100644
--- a/src/server/index.ts
+++ b/src/server/index.ts
@@ -100,21 +100,6 @@ function routeSetter(router: RouteManager) {
}
});
- const ServicesApiKeyMap = new Map<string, string | undefined>([
- ["face", process.env.FACE],
- ["vision", process.env.VISION],
- ["handwriting", process.env.HANDWRITING]
- ]);
-
- router.addSupervisedRoute({
- method: Method.GET,
- subscription: new RouteSubscriber("cognitiveServices").add('requestedService'),
- onValidation: ({ req, res }) => {
- let service = req.params.requestedService;
- res.send(ServicesApiKeyMap.get(service));
- }
- });
-
const EndpointHandlerMap = new Map<GoogleApiServerUtils.Action, GoogleApiServerUtils.ApiRouter>([
["create", (api, params) => api.create(params)],
["retrieve", (api, params) => api.get(params)],