update readme, add s3 bucket to webpack config

This commit is contained in:
catarak 2016-07-20 19:48:00 -04:00
parent f0872f8173
commit 7952eee7bd
4 changed files with 12 additions and 3 deletions

View file

@ -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 MONGO_URL=mongodb://localhost:27017/p5js-web-editor
PORT=8000 PORT=8000
SESSION_SECRET=whatever_you_want_this_to_be_it_only_matters_for_production SESSION_SECRET=whatever_you_want_this_to_be_it_only_matters_for_production
AWS_ACCESS_KEY=<your-aws-access-key>
AWS_SECRET_KEY=<your-aws-secret-key>
S3_BUCKET=<your-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` 5. `$ npm start`
6. Navigate to (http://localhost:8000)[http://localhost:8000] in your browser 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). 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 MONGO_URL=mongodb://localhost:27017/p5js-web-editor
PORT=8000 PORT=8000
SESSION_SECRET=make_this_a_long-random_string_like_maybe_126_characters_long SESSION_SECRET=make_this_a_long-random_string_like_maybe_126_characters_long
AWS_ACCESS_KEY=<your-aws-access-key>
AWS_SECRET_KEY=<your-aws-secret-key>
S3_BUCKET=<your-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.
5. `$ npm run build` 5. `$ npm run build`

View file

@ -1,7 +1,7 @@
import axios from 'axios'; import axios from 'axios';
import { createFile } from './files'; 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'; const ROOT_URL = location.href.indexOf('localhost') > 0 ? 'http://localhost:8000/api' : '/api';
export function dropzoneAcceptCallback(file, done) { export function dropzoneAcceptCallback(file, done) {

View file

@ -1,4 +1,5 @@
var webpack = require('webpack'); var webpack = require('webpack');
require('dotenv').config();
module.exports = { module.exports = {
devtool: 'cheap-module-eval-source-map', devtool: 'cheap-module-eval-source-map',
@ -19,6 +20,7 @@ module.exports = {
'process.env': { 'process.env': {
CLIENT: JSON.stringify(true), CLIENT: JSON.stringify(true),
'NODE_ENV': JSON.stringify('development'), 'NODE_ENV': JSON.stringify('development'),
'S3_BUCKET': '"' + process.env.S3_BUCKET + '"'
} }
}) })
], ],

View file

@ -44,7 +44,8 @@ module.exports = {
plugins: [ plugins: [
new webpack.DefinePlugin({ new webpack.DefinePlugin({
'process.env': { 'process.env': {
'NODE_ENV': JSON.stringify('production') 'NODE_ENV': JSON.stringify('production'),
'S3_BUCKET': '"' + process.env.S3_BUCKET + '"'
} }
}), }),
new webpack.optimize.UglifyJsPlugin({ new webpack.optimize.UglifyJsPlugin({