diff --git a/README.md b/README.md index a0b5367b444..811c14aca43 100644 --- a/README.md +++ b/README.md @@ -41,18 +41,20 @@ If you want to point the development web vault to the production APIs, you can r ``` npm install -ENV=production npm run build:oss:watch +ENV=cloud npm run build:oss:watch ``` You can also manually adjusting your API endpoint settings by adding `config/local.json` overriding any of the following values: ```json { - "proxyApi": "http://your-api-url", - "proxyIdentity": "http://your-identity-url", - "proxyEvents": "http://your-events-url", - "proxyNotifications": "http://your-notifications-url", - "allowedHosts": ["hostnames-to-allow-in-webpack"], + "dev": { + "proxyApi": "http://your-api-url", + "proxyIdentity": "http://your-identity-url", + "proxyEvents": "http://your-events-url", + "proxyNotifications": "http://your-notifications-url", + "allowedHosts": ["hostnames-to-allow-in-webpack"], + }, "urls": { } diff --git a/config.js b/config.js index dee8904f33f..429a8ea0ff0 100644 --- a/config.js +++ b/config.js @@ -3,6 +3,11 @@ function load(envName) { ...require('./config/base.json'), ...loadConfig(envName), ...loadConfig('local'), + dev: { + ...require('./config/base.json').dev, + ...loadConfig(envName).dev, + ...loadConfig('local').dev, + }, }; } diff --git a/config/base.json b/config/base.json index 49c320d3474..48ccb339aaf 100644 --- a/config/base.json +++ b/config/base.json @@ -5,5 +5,8 @@ "paypal": { "businessId": "AD3LAUZSNVPJY", "buttonAction": "https://www.sandbox.paypal.com/cgi-bin/webscr" + }, + "dev": { + "allowedHosts": [] } } diff --git a/config/cloud.json b/config/cloud.json index d4cdc426315..23f3542e683 100644 --- a/config/cloud.json +++ b/config/cloud.json @@ -8,5 +8,10 @@ "paypal": { "businessId": "4ZDA7DLUUJGMN", "buttonAction": "https://www.paypal.com/cgi-bin/webscr" + }, + "dev": { + "proxyApi": "https://api.bitwarden.com", + "proxyIdentity": "https://identity.bitwarden.com", + "proxyEvents": "https://events.bitwarden.com" } } diff --git a/config/development.json b/config/development.json index 6c1aa1b704f..c6470dd0eb0 100644 --- a/config/development.json +++ b/config/development.json @@ -1,10 +1,11 @@ { - "proxyApi": "http://localhost:4000", - "proxyIdentity": "http://localhost:33656", - "proxyEvents": "http://localhost:46273", - "proxyNotifications": "http://localhost:61840", - "allowedHosts": [], "urls": { "notifications": "http://localhost:61840" + }, + "dev": { + "proxyApi": "http://localhost:4000", + "proxyIdentity": "http://localhost:33656", + "proxyEvents": "http://localhost:46273", + "proxyNotifications": "http://localhost:61840" } } diff --git a/config/qa.json b/config/qa.json index 004613c3378..03032189be0 100644 --- a/config/qa.json +++ b/config/qa.json @@ -2,5 +2,10 @@ "urls": { "icons": "https://icons.qa.bitwarden.pw", "notifications": "https://notifications.qa.bitwarden.pw" + }, + "dev": { + "proxyApi": "https://api.qa.bitwarden.pw", + "proxyIdentity": "https://identity.qa.bitwarden.pw", + "proxyEvents": "https://events.qa.bitwarden.pw" } } diff --git a/webpack.config.js b/webpack.config.js index 962a664cf1c..e91469817df 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -169,7 +169,7 @@ const plugins = [ // ref: https://webpack.js.org/configuration/dev-server/#devserver let certSuffix = fs.existsSync('dev-server.local.pem') ? '.local' : '.shared'; -const devServer = ENV !== 'development' ? {} : { +const devServer = NODE_ENV !== 'development' ? {} : { https: { key: fs.readFileSync('dev-server' + certSuffix + '.pem'), cert: fs.readFileSync('dev-server' + certSuffix + '.pem'), @@ -177,32 +177,32 @@ const devServer = ENV !== 'development' ? {} : { // host: '192.168.1.9', proxy: { '/api': { - target: envConfig['proxyApi'], + target: envConfig.dev?.proxyApi, pathRewrite: {'^/api' : ''}, secure: false, changeOrigin: true }, '/identity': { - target: envConfig['proxyIdentity'], + target: envConfig.dev?.proxyIdentity, pathRewrite: {'^/identity' : ''}, secure: false, changeOrigin: true }, '/events': { - target: envConfig['proxyEvents'], + target: envConfig.dev?.proxyEvents, pathRewrite: {'^/events' : ''}, secure: false, changeOrigin: true }, '/notifications': { - target: envConfig['proxyNotifications'], + target: envConfig.dev?.proxyNotifications, pathRewrite: {'^/notifications' : ''}, secure: false, changeOrigin: true }, }, hot: false, - allowedHosts: envConfig['allowedHosts'] + allowedHosts: envConfig.dev?.allowedHosts, }; const webpackConfig = {