mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2025-02-17 00:21:20 -05:00
Use thumbnail image host from process.env
Limit built process.env to keys in src/env.json, which serves as a source for defaults.
This commit is contained in:
parent
f811cf82af
commit
446543c6c4
3 changed files with 11 additions and 1 deletions
|
@ -33,7 +33,7 @@ module.exports = React.createClass({
|
||||||
<Slider className={'carousel ' + this.props.className} {... this.props.settings}>
|
<Slider className={'carousel ' + this.props.className} {... this.props.settings}>
|
||||||
{this.props.items.map(function (item) {
|
{this.props.items.map(function (item) {
|
||||||
var thumbnailUrl = (
|
var thumbnailUrl = (
|
||||||
'//cdn2.scratch.mit.edu/get_image/' + item.type + '/' + item.id + '_' +
|
process.env.IMAGE_HOST + '/get_image/' + item.type + '/' + item.id + '_' +
|
||||||
this.typeDimensions[item.type][0] + 'x' + this.typeDimensions[item.type][1] + '.png' +
|
this.typeDimensions[item.type][0] + 'x' + this.typeDimensions[item.type][1] + '.png' +
|
||||||
'?v=' + item.thumbnailVersion
|
'?v=' + item.thumbnailVersion
|
||||||
);
|
);
|
||||||
|
|
3
src/env.json
Normal file
3
src/env.json
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"IMAGE_HOST": "//cdn2.scratch.mit.edu"
|
||||||
|
}
|
|
@ -1,6 +1,7 @@
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
var webpack = require('webpack');
|
var webpack = require('webpack');
|
||||||
var routes = require('./server/routes.json');
|
var routes = require('./server/routes.json');
|
||||||
|
var buildEnv = require('./src/env.json');
|
||||||
|
|
||||||
// Prepare all entry points
|
// Prepare all entry points
|
||||||
var entry = {
|
var entry = {
|
||||||
|
@ -48,6 +49,12 @@ module.exports = {
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
|
new webpack.DefinePlugin({
|
||||||
|
'process.env': Object.keys(buildEnv).reduce(function (env, key) {
|
||||||
|
env[key] = JSON.stringify(process.env[key] || env[key]);
|
||||||
|
return env;
|
||||||
|
}, buildEnv)
|
||||||
|
}),
|
||||||
new webpack.optimize.UglifyJsPlugin({
|
new webpack.optimize.UglifyJsPlugin({
|
||||||
compress: {
|
compress: {
|
||||||
warnings: false
|
warnings: false
|
||||||
|
|
Loading…
Reference in a new issue