From 0ae8c425ee8543f0b106a49d90d8acec9d389616 Mon Sep 17 00:00:00 2001 From: kevmodrome Date: Thu, 2 Jul 2020 21:25:25 +0200 Subject: [PATCH] fetching keys now done correctly --- packages/server/src/api/controllers/apikeys.js | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/packages/server/src/api/controllers/apikeys.js b/packages/server/src/api/controllers/apikeys.js index 8fc0260617..3a993f53ae 100644 --- a/packages/server/src/api/controllers/apikeys.js +++ b/packages/server/src/api/controllers/apikeys.js @@ -1,21 +1,11 @@ const fs = require("fs") - const ENV_FILE_PATH = ".budibase/.env" exports.fetch = async function (ctx) { - // Check if structure of call makes sense, if not, return error - - - // Read File - const fileContent = await getEnvironmentVariables() - const keys = await extractKeys(fileContent) - - // Temporary while "real" infrastructure to store keys is created ctx.status = 200 - ctx.message = "API Keys" ctx.body = { - budibase: 'testFromBackEnd', - sendgrid: 'testFromBackEnd' + budibase: process.env.BUDIBASE_API_KEY, + sendgrid: process.env.SENDGRID_API_KEY } } @@ -41,6 +31,7 @@ async function getEnvironmentVariables() { async function extractKeys(content) { const lines = content.split(/\r?\n/) + console.log(lines) // Extract keys here - return [] + return lines } \ No newline at end of file