From fd4846379b0aea8f3bf37375db69c64fb633d1ce Mon Sep 17 00:00:00 2001 From: "mike.rode" Date: Thu, 14 Feb 2019 23:59:13 -0600 Subject: [PATCH] Use env file to set plex token. --- .gitignore | 3 ++- config/index.js | 1 + config/plex.js | 3 +-- index.js | 2 -- server/models/index.js | 1 - server/services/plexApi/helpers.js | 1 - server/services/plexApi/plexApi.js | 3 +-- 7 files changed, 5 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index 2960c0f..68d0f48 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ +.env node_modules .vscode .nyc_output dist -npm-debug.log \ No newline at end of file +npm-debug.log diff --git a/config/index.js b/config/index.js index 01e2fff..08a050b 100644 --- a/config/index.js +++ b/config/index.js @@ -1,4 +1,5 @@ /* eslint-disable no-undef */ +require('dotenv').config(); const _ = require('lodash'); const env = process.env.NODE_ENV || 'local'; diff --git a/config/plex.js b/config/plex.js index 10ecddb..2bd70f1 100644 --- a/config/plex.js +++ b/config/plex.js @@ -2,7 +2,6 @@ const plexConfig = { ip: 'http://192.168.0.44', plexServerUrl: 'https://plex.mjrflix.com', plexApiUrl: 'https://plex.tv/api', - token: 'testPlexApiToken', + token: process.env.PLEX_API_TOKEN, }; - export default plexConfig; diff --git a/index.js b/index.js index d1348af..41b57a5 100644 --- a/index.js +++ b/index.js @@ -1,7 +1,5 @@ import config from './config'; -require('dotenv').config() - const server = require('./server').default(); server.create(config); diff --git a/server/models/index.js b/server/models/index.js index de7301e..b9be50a 100644 --- a/server/models/index.js +++ b/server/models/index.js @@ -8,7 +8,6 @@ const sequelize = new Sequelize( dialect: 'postgres', host: 'localhost', }, - console.log(process.env.DATABASE), ); const models = { diff --git a/server/services/plexApi/helpers.js b/server/services/plexApi/helpers.js index 918643b..bb4daba 100644 --- a/server/services/plexApi/helpers.js +++ b/server/services/plexApi/helpers.js @@ -5,7 +5,6 @@ const formatResponse = response => { if (xmlResponse) { return JSON.parse(parser.toJson(response.data)); } - // console.log(JSON.stringify(response.data)); return response.data; }; diff --git a/server/services/plexApi/plexApi.js b/server/services/plexApi/plexApi.js index 15cf7f1..52e45c2 100644 --- a/server/services/plexApi/plexApi.js +++ b/server/services/plexApi/plexApi.js @@ -45,7 +45,6 @@ PlexApiClient.prototype.mostWatchedUrlParams = function(query) { }; PlexApiClient.prototype.getLibraryDataBySectionUrlParams = function(query) { - console.log('url query', query.sectionId); return { host: config.plex.plexServerUrl, path: `/library/sections/${query.sectionId}/all`, @@ -80,7 +79,7 @@ PlexApiClient.prototype.request = async function(url) { }) .catch(error => { if (error.response) { - console.log('data', error.response.data); + // console.log('data', error.response.data); console.log('status', error.response.status); console.log('headers', error.response.headers); return reject(error.response);