From 5613a285f6fefc25a27980231b921a46d6528995 Mon Sep 17 00:00:00 2001 From: Cassie Tarakajian Date: Thu, 17 May 2018 17:45:48 -0700 Subject: [PATCH] move github files to .github folder, delete useless server config, get development Docker build working --- CODE_OF_CONDUCT.md => .github/CODE_OF_CONDUCT.md | 0 contributing.md => .github/CONTRIBUTING.md | 0 ISSUE_TEMPLATE.md => .github/ISSUE_TEMPLATE.md | 0 .../PULL_REQUEST_TEMPLATE.md | 0 Dockerfile | 2 +- index.js | 11 ++++++----- server/config.js | 6 ------ server/server.js | 8 +++----- 8 files changed, 10 insertions(+), 17 deletions(-) rename CODE_OF_CONDUCT.md => .github/CODE_OF_CONDUCT.md (100%) rename contributing.md => .github/CONTRIBUTING.md (100%) rename ISSUE_TEMPLATE.md => .github/ISSUE_TEMPLATE.md (100%) rename PULL_REQUEST_TEMPLATE.md => .github/PULL_REQUEST_TEMPLATE.md (100%) delete mode 100644 server/config.js diff --git a/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md similarity index 100% rename from CODE_OF_CONDUCT.md rename to .github/CODE_OF_CONDUCT.md diff --git a/contributing.md b/.github/CONTRIBUTING.md similarity index 100% rename from contributing.md rename to .github/CONTRIBUTING.md diff --git a/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md similarity index 100% rename from ISSUE_TEMPLATE.md rename to .github/ISSUE_TEMPLATE.md diff --git a/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md similarity index 100% rename from PULL_REQUEST_TEMPLATE.md rename to .github/PULL_REQUEST_TEMPLATE.md diff --git a/Dockerfile b/Dockerfile index 6d75fe0c..a1330f5c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM node:8.9.0 +FROM node:8.11.1 ENV APP_HOME=/opt/node/app \ TERM=xterm diff --git a/index.js b/index.js index e8b25418..f99dabf7 100644 --- a/index.js +++ b/index.js @@ -17,10 +17,11 @@ if (process.env.NODE_ENV === 'production') { }); require('babel-polyfill'); //// in development, let .env values override those in the environment already (i.e. in docker-compose.yml) - if (process.env.NODE_ENV === 'development') { - for (let key in parsed) { - process.env[key] = parsed[key]; - } - } + // so commenting this out makes the docker container work. + // if (process.env.NODE_ENV === 'development') { + // for (let key in parsed) { + // process.env[key] = parsed[key]; + // } + // } require('./server/server'); } diff --git a/server/config.js b/server/config.js deleted file mode 100644 index cf7fb8e8..00000000 --- a/server/config.js +++ /dev/null @@ -1,6 +0,0 @@ -const config = { - mongoURL: process.env.MONGO_URL || 'mongodb://localhost:27017/p5js-web-editor', - port: process.env.PORT || 8000, -}; - -export default config; diff --git a/server/server.js b/server/server.js index d186ff4e..efb915b7 100644 --- a/server/server.js +++ b/server/server.js @@ -15,7 +15,6 @@ import webpackHotMiddleware from 'webpack-hot-middleware'; import config from '../webpack.config.dev'; // Import all required modules -import serverConfig from './config'; import users from './routes/user.routes'; import sessions from './routes/session.routes'; import projects from './routes/project.routes'; @@ -106,8 +105,7 @@ require('./config/passport'); // const passportConfig = require('./config/passport'); // Connect to MongoDB -// mongoose.connect(process.env.MONGODB_URI || process.env.MONGOLAB_URI); -mongoose.connect(serverConfig.mongoURL); +mongoose.connect(process.env.MONGO_URL); mongoose.connection.on('error', () => { console.error('MongoDB Connection Error. Please make sure that MongoDB is running.'); process.exit(1); @@ -132,9 +130,9 @@ app.get('*', (req, res) => { }); // start app -app.listen(serverConfig.port, (error) => { +app.listen(process.env.PORT, (error) => { if (!error) { - console.log(`p5js web editor is running on port: ${serverConfig.port}!`); // eslint-disable-line + console.log(`p5js web editor is running on port: ${process.env.PORT}!`); // eslint-disable-line } });