Skip to content
This repository has been archived by the owner on Mar 27, 2020. It is now read-only.

Commit

Permalink
Merge pull request #25 from knotel/feature/PLAT-58
Browse files Browse the repository at this point in the history
fix: hack to fix knot issue with keys with new lines and spaces
  • Loading branch information
stephendaimler authored Mar 6, 2019
2 parents 7378951 + c387883 commit 4f697eb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion gdrive.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ const delay = (ms) => {

class GDrive {
constructor () {
// Hack to fix knot problem with key that has spaces and new lines.
// TODO: Replace with base64 encoding and decoding.
let PRIVATE_KEY = process.env.PRIVATE_KEY
PRIVATE_KEY = PRIVATE_KEY.replace(/<SPACE>/g, ' ')
PRIVATE_KEY = PRIVATE_KEY.replace(/<NEWLINE>/g, '\n')
this.driveOptions = {
pageSize: 200,
corpora: 'teamDrive',
Expand All @@ -22,7 +27,7 @@ class GDrive {
this.authCredentials = [
process.env.CLIENT_EMAIL,
null,
process.env.PRIVATE_KEY,
PRIVATE_KEY,
['https://www.googleapis.com/auth/drive'],
process.env.USER_EMAIL,
]
Expand Down

0 comments on commit 4f697eb

Please sign in to comment.