Skip to content

Commit

Permalink
refactor env vars in webpack.config and pwadevserver files
Browse files Browse the repository at this point in the history
  • Loading branch information
sharkySharks committed Feb 8, 2019
1 parent 87bb403 commit 17d4a6a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
1 change: 0 additions & 1 deletion docker/.env.docker
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,3 @@ UPWARD_JS_UPWARD_PATH=venia-upward.yml
UPWARD_JS_BIND_LOCAL=1
UPWARD_JS_LOG_URL=1
BRAINTREE_TOKEN=sandbox_8yrzsvtm_s2bg8fs563crhqzk
DOCKER_CONFIG=1
10 changes: 6 additions & 4 deletions packages/pwa-buildpack/src/WebpackTools/PWADevServer.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
require('dotenv').config();
const debug = require('../util/debug').makeFileLogger(__filename);
const debugErrorMiddleware = require('debug-error-middleware').express;
const {
Expand Down Expand Up @@ -44,8 +45,10 @@ const PWADevServer = {
contentBase: false, // UpwardPlugin serves static files
compress: true,
hot: true,
host: config.host || '0.0.0.0',
port: config.port || (await portscanner.findAPortNotInUse(10000)),
host: process.env.PWA_STUDIO_HOST_DEVELOPMENT || '0.0.0.0',
port:
process.env.PWA_STUDIO_PORTS_DEVELOPMENT ||
(await portscanner.findAPortNotInUse(10000)),
stats: {
all: !process.env.NODE_DEBUG ? false : undefined,
builtAt: true,
Expand All @@ -59,8 +62,7 @@ const PWADevServer = {
},
after(app, server) {
app.use(debugErrorMiddleware());
require('dotenv').config();
let publicPath = process.env.DOCKER_CONFIG
let publicPath = process.env.PWA_STUDIO_PUBLIC_PATH
? 'https://' + process.env.PWA_STUDIO_PUBLIC_PATH
: devServerConfig.publicPath;
let readyNotice = chalk.green(
Expand Down
4 changes: 1 addition & 3 deletions packages/venia-concept/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,7 @@ module.exports = async function(env) {
validEnv.PWA_STUDIO_PUBLIC_PATH || config.output.publicPath,
graphqlPlayground: {
queryDirs: [path.resolve(themePaths.src, 'queries')]
},
port: validEnv.PWA_STUDIO_PORTS_DEVELOPMENT,
host: validEnv.PWA_STUDIO_HOST_DEVELOPMENT
}
};
const provideHost = !!validEnv.MAGENTO_BUILDPACK_PROVIDE_SECURE_HOST;
if (provideHost) {
Expand Down

0 comments on commit 17d4a6a

Please sign in to comment.