Commit c0240178 authored by Matija Obreza's avatar Matija Obreza
Browse files

Fixed webpacked server

- Webpack replaced process.env with a JSON object and we don't have access to process.env
parent c44c99c2
......@@ -48,7 +48,8 @@ module.exports = {
// https://facebook.github.io/react/docs/optimizing-performance.html#use-the-production-build
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('production')
NODE_ENV: JSON.stringify('production'),
SSR: JSON.stringify(true)
}
}),
......
......@@ -201,13 +201,6 @@ module.exports = {
plugins: [
new HtmlWebpackExcludeAssetsPlugin(),
new webpack.DefinePlugin({
'process.env': {
GOOGLE_CLIENT_ID: JSON.stringify(GOOGLE_CLIENT_ID),
SSR: JSON.stringify(SSR)
}
}),
/* new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
minChunks: Infinity
......
......@@ -19,15 +19,6 @@ module.exports = webpackMerge(commonConfig, {
plugins: [
new webpack.NamedModulesPlugin(),
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('development'),
// CLIENT_ID: JSON.stringify(config.clientId),
// CLIENT_SECRET: JSON.stringify(config.clientSecret),
// CATALOG_API_URL: JSON.stringify(config.apiUrl)
}
}),
new webpack.LoaderOptionsPlugin({
minimize: false,
debug: true,
......
#!/bin/sh
echo "Running Genesys Catalog UI from `pwd` with CLIENT_ID=${CLIENT_ID} and API at ${CATALOG_API_URL}"
echo "Starting on TCP port ${PORT} (default 3000)."
exec pm2-docker start --auto-exit catalogui-pm2.yml
exec pm2-docker start --auto-exit catalogui-pm2.yml --args "--api-url='${CATALOG_API_URL}' --client-id='${CLIENT_ID}' --client-secret='${CLIENT_SECRET}'"
......@@ -7090,10 +7090,9 @@
}
},
"minimist": {
"version": "0.0.8",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=",
"dev": true
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ="
},
"minimist-options": {
"version": "3.0.2",
......@@ -7169,6 +7168,14 @@
"dev": true,
"requires": {
"minimist": "0.0.8"
},
"dependencies": {
"minimist": {
"version": "0.0.8",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=",
"dev": true
}
}
},
"moment": {
......@@ -15013,12 +15020,6 @@
"lodash": "4.17.4"
}
},
"webpack-node-externals": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/webpack-node-externals/-/webpack-node-externals-1.6.0.tgz",
"integrity": "sha1-Iyxi7GCSsQBjWj0p2DwXRxKN+b0=",
"dev": true
},
"webpack-sources": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-1.1.0.tgz",
......
import * as minimist from 'minimist';
// console.log(process.argv);
const argv = minimist(process.argv.slice(2), {
string: ['--api-url', '--api-timeout', '--client-id', '--client-secret' ],
});
console.dir(argv);
/**
* Application configuration
*/
const config = {
// Catalog API host
apiUrl: argv['api-url'] || 'https://api.catalog.demo.genesys-pgr.org',
// Timeout (ms) for proxied calls to the API
apiTimeout: +(argv['api-timeout'] || 2000),
// OAuth Client
clientId: argv['client-id'] || 'my-trusted-client',
clientSecret: argv['client-secret'] || 'my-secret-client',
};
console.log('Catalog config', config);
export default config;
import * as proxy from 'express-http-proxy';
import config from 'config';
import config from '../config';
const httpProxy = proxy(config.apiUrl, {
parseReqBody: false,
......
/**
* Application configuration
*/
const config = {
// Catalog API host
apiUrl: process.env.CATALOG_API_URL || 'https://api.catalog.demo.genesys-pgr.org',
// Timeout (ms) for proxied calls to the API
apiTimeout: +(process.env.API_TIMEOUT || 2000),
// OAuth Client
clientId: process.env.CLIENT_ID || 'my-trusted-client',
clientSecret: process.env.CLIENT_SECRET || 'my-secret-client',
};
console.log('process.env.CATALOG_API_URL', process.env.CATALOG_API_URL);
console.log('process.env.API_TIMEOUT', process.env.API_TIMEOUT);
console.log('process.env.CLIENT_ID', process.env.CLIENT_ID);
console.log('process.env.CLIENT_SECRET', process.env.CLIENT_SECRET);
console.log('Catalog config', config);
export default config;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment