diff --git a/pages/api/content/sharepoint/index.js b/pages/api/content/sharepoint/index.js index a0b0fc3d..7021301a 100644 --- a/pages/api/content/sharepoint/index.js +++ b/pages/api/content/sharepoint/index.js @@ -9,7 +9,11 @@ import mime from 'mime-types'; // configure your node options (only once in your application) - const buffer = readFileSync(process.env.SHAREPOINT_PRIVATE_KEY_FILE); + let buffer = process.env.SHAREPOINT_PRIVATE_KEY; + if (!buffer) { + const privateKeyPath = process.env.SHAREPOINT_PRIVATE_KEY_FILE; + buffer = readFileSync(privateKeyPath); + } const config = { auth: {