From 7952eee7bd11317c427f013172e11969463315f8 Mon Sep 17 00:00:00 2001 From: catarak Date: Wed, 20 Jul 2016 19:48:00 -0400 Subject: [PATCH] update readme, add s3 bucket to webpack config --- README.md | 8 +++++++- client/modules/IDE/actions/uploader.js | 2 +- webpack.config.dev.js | 2 ++ webpack.config.prod.js | 3 ++- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a940d0e5..beb90ed7 100644 --- a/README.md +++ b/README.md @@ -12,8 +12,11 @@ This project is currently in the early stages of development! It will definitely MONGO_URL=mongodb://localhost:27017/p5js-web-editor PORT=8000 SESSION_SECRET=whatever_you_want_this_to_be_it_only_matters_for_production +AWS_ACCESS_KEY= +AWS_SECRET_KEY= +S3_BUCKET= ``` -Or, if you don't want to do that, just ask me to send you mine. +Or, if you don't want to do that, just ask me to send you mine. Refer to this gist for creating an S3 bucket for testing, or if you don't want to do that, I will send you my AWS credentials. 5. `$ npm start` 6. Navigate to (http://localhost:8000)[http://localhost:8000] in your browser 7. Install the [React Developer Tools](https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi?hl=en). @@ -28,6 +31,9 @@ Or, if you don't want to do that, just ask me to send you mine. MONGO_URL=mongodb://localhost:27017/p5js-web-editor PORT=8000 SESSION_SECRET=make_this_a_long-random_string_like_maybe_126_characters_long +AWS_ACCESS_KEY= +AWS_SECRET_KEY= +S3_BUCKET= ``` Or, if you don't want to do that, just ask me to send you mine. 5. `$ npm run build` diff --git a/client/modules/IDE/actions/uploader.js b/client/modules/IDE/actions/uploader.js index 09e0513a..c8a44d3f 100644 --- a/client/modules/IDE/actions/uploader.js +++ b/client/modules/IDE/actions/uploader.js @@ -1,7 +1,7 @@ import axios from 'axios'; import { createFile } from './files'; -const s3Bucket = 'http://p5js-web-editor-test.s3.amazonaws.com/'; +const s3Bucket = `http://${process.env.S3_BUCKET}.s3.amazonaws.com/`; const ROOT_URL = location.href.indexOf('localhost') > 0 ? 'http://localhost:8000/api' : '/api'; export function dropzoneAcceptCallback(file, done) { diff --git a/webpack.config.dev.js b/webpack.config.dev.js index 190db37f..b12a2492 100644 --- a/webpack.config.dev.js +++ b/webpack.config.dev.js @@ -1,4 +1,5 @@ var webpack = require('webpack'); +require('dotenv').config(); module.exports = { devtool: 'cheap-module-eval-source-map', @@ -19,6 +20,7 @@ module.exports = { 'process.env': { CLIENT: JSON.stringify(true), 'NODE_ENV': JSON.stringify('development'), + 'S3_BUCKET': '"' + process.env.S3_BUCKET + '"' } }) ], diff --git a/webpack.config.prod.js b/webpack.config.prod.js index bca5d6e0..86c8f96b 100644 --- a/webpack.config.prod.js +++ b/webpack.config.prod.js @@ -44,7 +44,8 @@ module.exports = { plugins: [ new webpack.DefinePlugin({ 'process.env': { - 'NODE_ENV': JSON.stringify('production') + 'NODE_ENV': JSON.stringify('production'), + 'S3_BUCKET': '"' + process.env.S3_BUCKET + '"' } }), new webpack.optimize.UglifyJsPlugin({