move github files to .github folder, delete useless server config, get development Docker build working

This commit is contained in:
Cassie Tarakajian 2018-05-17 17:45:48 -07:00
parent 9958619fc4
commit 2fe11eb707
8 changed files with 10 additions and 17 deletions

View file

@ -1,4 +1,4 @@
FROM node:8.9.0 FROM node:8.11.1
ENV APP_HOME=/opt/node/app \ ENV APP_HOME=/opt/node/app \
TERM=xterm TERM=xterm

View file

@ -17,10 +17,11 @@ if (process.env.NODE_ENV === 'production') {
}); });
require('babel-polyfill'); require('babel-polyfill');
//// in development, let .env values override those in the environment already (i.e. in docker-compose.yml) //// in development, let .env values override those in the environment already (i.e. in docker-compose.yml)
if (process.env.NODE_ENV === 'development') { // so commenting this out makes the docker container work.
for (let key in parsed) { // if (process.env.NODE_ENV === 'development') {
process.env[key] = parsed[key]; // for (let key in parsed) {
} // process.env[key] = parsed[key];
} // }
// }
require('./server/server'); require('./server/server');
} }

View file

@ -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;

View file

@ -15,7 +15,6 @@ import webpackHotMiddleware from 'webpack-hot-middleware';
import config from '../webpack.config.dev'; import config from '../webpack.config.dev';
// Import all required modules // Import all required modules
import serverConfig from './config';
import users from './routes/user.routes'; import users from './routes/user.routes';
import sessions from './routes/session.routes'; import sessions from './routes/session.routes';
import projects from './routes/project.routes'; import projects from './routes/project.routes';
@ -106,8 +105,7 @@ require('./config/passport');
// const passportConfig = require('./config/passport'); // const passportConfig = require('./config/passport');
// Connect to MongoDB // Connect to MongoDB
// mongoose.connect(process.env.MONGODB_URI || process.env.MONGOLAB_URI); mongoose.connect(process.env.MONGO_URL);
mongoose.connect(serverConfig.mongoURL);
mongoose.connection.on('error', () => { mongoose.connection.on('error', () => {
console.error('MongoDB Connection Error. Please make sure that MongoDB is running.'); console.error('MongoDB Connection Error. Please make sure that MongoDB is running.');
process.exit(1); process.exit(1);
@ -132,9 +130,9 @@ app.get('*', (req, res) => {
}); });
// start app // start app
app.listen(serverConfig.port, (error) => { app.listen(process.env.PORT, (error) => {
if (!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
} }
}); });