Skip to content

Commit

Permalink
add envvar
Browse files Browse the repository at this point in the history
  • Loading branch information
hrz8 committed Jan 9, 2022
1 parent 5deae6e commit 7e9dd5e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
require('dotenv').config();
const env = require('env-var');
const express = require("express");
const app = express();

const { google } = require("googleapis");
const auth = new google.auth.GoogleAuth({
credentials: JSON.parse(process.env.GOOGLE_SERVICE_ACCOUNT),
credentials: JSON.parse(env.get('GOOGLE_SERVICE_ACCOUNT').required()),
scopes: ["https://www.googleapis.com/auth/spreadsheets.readonly"],
});
const sheets = google.sheets({ version: "v4", auth });
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"dependencies": {
"cors": "^2.8.5",
"dotenv": "^10.0.0",
"env-var": "^7.1.1",
"express": "^4.17.2",
"googleapis": "^88.2.0",
"morgan": "^1.10.0"
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,11 @@ encodeurl@~1.0.2:
resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59"
integrity sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=

env-var@^7.1.1:
version "7.1.1"
resolved "https://registry.yarnpkg.com/env-var/-/env-var-7.1.1.tgz#c1697f8dfded0b54418dc9bbd78a82119910e57c"
integrity sha512-4+vvlq+wwGQNwY/nI3/+Ojc1MKHCmITRJ6VWkQzDtMD6fAEb60ACRUCnlIAonMKW9YzqYmYxbyVu9vTb++yNRg==

escape-html@~1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988"
Expand Down

0 comments on commit 7e9dd5e

Please sign in to comment.