0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-06 05:42:40 +00:00

Fix Config spelling (must be all lowercase)

This commit is contained in:
Trevor Buckner
2020-10-07 16:17:05 -04:00
parent 131df2d82a
commit 28ed2fe8f2
2 changed files with 8 additions and 11 deletions

View File

@@ -17,9 +17,6 @@ const config = require('nconf')
.file('environment', { file: `config/${process.env.NODE_ENV}.json` }) .file('environment', { file: `config/${process.env.NODE_ENV}.json` })
.file('defaults', { file: 'config/default.json' }); .file('defaults', { file: 'config/default.json' });
console.log(config.get('googleClientId'));
console.log(config.get('secret'));
console.log(config.get('googleApiKey'));
//DB //DB
const mongoose = require('mongoose'); const mongoose = require('mongoose');
mongoose.connect(config.get('mongodb_uri') || config.get('mongolab_uri') || 'mongodb://localhost/naturalcrit', mongoose.connect(config.get('mongodb_uri') || config.get('mongolab_uri') || 'mongodb://localhost/naturalcrit',
@@ -41,8 +38,8 @@ app.use((req, res, next)=>{
} }
req.config = { req.config = {
googleClientId : config.get('googleClientId'), google_client_id : config.get('google_client_id'),
googleClientSecret : config.get('googleClientSecret') google_client_secret : config.get('google_client_secret')
}; };
return next(); return next();
}); });
@@ -71,7 +68,7 @@ app.get('/source/:id', (req, res)=>{
if(req.params.id.length > 12) { if(req.params.id.length > 12) {
const googleId = req.params.id.slice(0, -12); const googleId = req.params.id.slice(0, -12);
const shareId = req.params.id.slice(-12); const shareId = req.params.id.slice(-12);
GoogleActions.readFileMetadata(config.get('googleApiKey'), googleId, shareId, 'share') GoogleActions.readFileMetadata(config.get('google_api_key'), googleId, shareId, 'share')
.then((brew)=>{ .then((brew)=>{
const text = brew.text.replaceAll('<', '&lt;').replaceAll('>', '&gt;'); const text = brew.text.replaceAll('<', '&lt;').replaceAll('>', '&gt;');
return res.send(`<code><pre style="white-space: pre-wrap;">${text}</pre></code>`); return res.send(`<code><pre style="white-space: pre-wrap;">${text}</pre></code>`);
@@ -123,7 +120,7 @@ app.get('/edit/:id', (req, res, next)=>{
if(req.params.id.length > 12) { if(req.params.id.length > 12) {
const googleId = req.params.id.slice(0, -12); const googleId = req.params.id.slice(0, -12);
const editId = req.params.id.slice(-12); const editId = req.params.id.slice(-12);
GoogleActions.readFileMetadata(config.get('googleApiKey'), googleId, editId, 'edit') GoogleActions.readFileMetadata(config.get('google_api_key'), googleId, editId, 'edit')
.then((brew)=>{ .then((brew)=>{
req.brew = brew; //TODO Need to sanitize later req.brew = brew; //TODO Need to sanitize later
return next(); return next();
@@ -150,7 +147,7 @@ app.get('/share/:id', (req, res, next)=>{
if(req.params.id.length > 12) { if(req.params.id.length > 12) {
const googleId = req.params.id.slice(0, -12); const googleId = req.params.id.slice(0, -12);
const shareId = req.params.id.slice(-12); const shareId = req.params.id.slice(-12);
GoogleActions.readFileMetadata(config.get('googleApiKey'), googleId, shareId, 'share') GoogleActions.readFileMetadata(config.get('google_api_key'), googleId, shareId, 'share')
.then((brew)=>{ .then((brew)=>{
req.brew = brew; //TODO Need to sanitize later req.brew = brew; //TODO Need to sanitize later
return next(); return next();

View File

@@ -21,8 +21,8 @@ GoogleActions = {
} }
const oAuth2Client = new google.auth.OAuth2( const oAuth2Client = new google.auth.OAuth2(
config.get('googleClientId'), config.get('google_client_id'),
config.get('googleClientSecret'), config.get('google_client_secret'),
'/auth/google/redirect' '/auth/google/redirect'
); );
@@ -225,7 +225,7 @@ GoogleActions = {
readFileMetadata : async (auth, id, accessId, accessType)=>{ readFileMetadata : async (auth, id, accessId, accessType)=>{
const drive = google.drive({ version: 'v3', auth: auth }); const drive = google.drive({ version: 'v3', auth: auth });
console.log(auth); console.log(auth);
const obj = await drive.files.get({ const obj = await drive.files.get({
fileId : id, fileId : id,
fields : 'properties' fields : 'properties'