#339 add region to .env
This commit is contained in:
parent
40b3e26f24
commit
2a9ea85ed8
8 changed files with 13 additions and 8 deletions
|
@ -19,6 +19,7 @@ This project is currently in development! It will be announced when there is a (
|
|||
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>
|
||||
AWS_REGION=<your-aws-region>
|
||||
S3_BUCKET=<your-s3-bucket>
|
||||
GITHUB_ID=<your-github-client-id>
|
||||
GITHUB_SECRET=<your-github-client-secret>
|
||||
|
@ -49,6 +50,7 @@ The automatic redirection to HTTPS is turned off by default in development. If y
|
|||
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>
|
||||
AWS_REGION=<your-aws-region>
|
||||
S3_BUCKET=<your-s3-bucket>
|
||||
GITHUB_ID=<your-github-client-id>
|
||||
GITHUB_SECRET=<your-github-client-secret>
|
||||
|
|
|
@ -2,7 +2,7 @@ import axios from 'axios';
|
|||
import { createFile } from './files';
|
||||
|
||||
const textFileRegex = /(text\/|application\/json)/;
|
||||
const s3BucketHttps = `https://s3-us-west-2.amazonaws.com/${process.env.S3_BUCKET}/`;
|
||||
const s3BucketHttps = `https://s3-${process.env.AWS_REGION}.amazonaws.com/${process.env.S3_BUCKET}/`;
|
||||
const ROOT_URL = process.env.API_URL;
|
||||
const MAX_LOCAL_FILE_SIZE = 80000; // bytes, aka 80 KB
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ import { bindActionCreators } from 'redux';
|
|||
import { connect } from 'react-redux';
|
||||
import * as UploaderActions from '../actions/uploader';
|
||||
|
||||
const s3Bucket = `https://s3-us-west-2.amazonaws.com/${process.env.S3_BUCKET}/`;
|
||||
const s3Bucket = `https://s3-${process.env.AWS_REGION}.amazonaws.com/${process.env.S3_BUCKET}/`;
|
||||
|
||||
class FileUploader extends React.Component {
|
||||
componentDidMount() {
|
||||
|
|
|
@ -11,10 +11,11 @@ const client = s3.createClient({
|
|||
s3Options: {
|
||||
accessKeyId: `${process.env.AWS_ACCESS_KEY}`,
|
||||
secretAccessKey: `${process.env.AWS_SECRET_KEY}`,
|
||||
region: `${process.env.AWS_REGION}`
|
||||
},
|
||||
});
|
||||
|
||||
const s3Bucket = `https://s3-us-west-2.amazonaws.com/${process.env.S3_BUCKET}/`;
|
||||
const s3Bucket = `https://s3-${process.env.AWS_REGION}.amazonaws.com/${process.env.S3_BUCKET}/`;
|
||||
|
||||
function getExtension(filename) {
|
||||
const i = filename.lastIndexOf('.');
|
||||
|
|
|
@ -24,7 +24,7 @@ let client = s3.createClient({
|
|||
s3Options: {
|
||||
accessKeyId: `${process.env.AWS_ACCESS_KEY}`,
|
||||
secretAccessKey: `${process.env.AWS_SECRET_KEY}`,
|
||||
region: 'us-west-2'
|
||||
region: `${process.env.AWS_REGION}`
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ let client = s3.createClient({
|
|||
s3Options: {
|
||||
accessKeyId: `${process.env.AWS_ACCESS_KEY}`,
|
||||
secretAccessKey: `${process.env.AWS_SECRET_KEY}`,
|
||||
region: 'us-west-2'
|
||||
region: `${process.env.AWS_REGION}`
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -42,7 +42,7 @@ Project.find({}, (err, projects) => {
|
|||
console.log(err);
|
||||
})
|
||||
.on('end', () => {
|
||||
file.url = `https://s3-us-west-2.amazonaws.com/${process.env.S3_BUCKET}/${userId}/${key}`;
|
||||
file.url = `https://s3-${process.env.AWS_REGION}.amazonaws.com/${process.env.S3_BUCKET}/${userId}/${key}`;
|
||||
project.save((err, savedProject) => {
|
||||
console.log(`updated file ${key}`);
|
||||
});
|
||||
|
|
|
@ -40,7 +40,8 @@ module.exports = {
|
|||
JSON.stringify(true) :
|
||||
JSON.stringify(false),
|
||||
'NODE_ENV': JSON.stringify('development'),
|
||||
'S3_BUCKET': '"' + process.env.S3_BUCKET + '"'
|
||||
'S3_BUCKET': '"' + process.env.S3_BUCKET + '"',
|
||||
'AWS_REGION': '"' + process.env.AWS_REGION + '"',
|
||||
}
|
||||
})
|
||||
],
|
||||
|
|
|
@ -78,7 +78,8 @@ module.exports = {
|
|||
'process.env': {
|
||||
'API_URL': '"' + process.env.API_URL + '"',
|
||||
'NODE_ENV': JSON.stringify('production'),
|
||||
'S3_BUCKET': '"' + process.env.S3_BUCKET + '"'
|
||||
'S3_BUCKET': '"' + process.env.S3_BUCKET + '"',
|
||||
'AWS_REGION': '"' + process.env.AWS_REGION + '"'
|
||||
}
|
||||
}),
|
||||
new webpack.optimize.CommonsChunkPlugin({
|
||||
|
|
Loading…
Reference in a new issue