mirror of
https://github.com/bitwarden/browser.git
synced 2025-01-02 18:17:46 +01:00
Update local web development instructions (#1208)
* Indicate production with NODE_ENV * Use local.json config to point to Bitwarden production APIs * Add proxy configuration to cloud and qa environment * Move notifications to urls Co-authored-by: Hinton <oscar@oscarhinton.com>
This commit is contained in:
parent
6c581b3ebc
commit
6d4f163824
@ -41,18 +41,20 @@ If you want to point the development web vault to the production APIs, you can r
|
|||||||
|
|
||||||
```
|
```
|
||||||
npm install
|
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:
|
You can also manually adjusting your API endpoint settings by adding `config/local.json` overriding any of the following values:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
|
"dev": {
|
||||||
"proxyApi": "http://your-api-url",
|
"proxyApi": "http://your-api-url",
|
||||||
"proxyIdentity": "http://your-identity-url",
|
"proxyIdentity": "http://your-identity-url",
|
||||||
"proxyEvents": "http://your-events-url",
|
"proxyEvents": "http://your-events-url",
|
||||||
"proxyNotifications": "http://your-notifications-url",
|
"proxyNotifications": "http://your-notifications-url",
|
||||||
"allowedHosts": ["hostnames-to-allow-in-webpack"],
|
"allowedHosts": ["hostnames-to-allow-in-webpack"],
|
||||||
|
},
|
||||||
"urls": {
|
"urls": {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,11 @@ function load(envName) {
|
|||||||
...require('./config/base.json'),
|
...require('./config/base.json'),
|
||||||
...loadConfig(envName),
|
...loadConfig(envName),
|
||||||
...loadConfig('local'),
|
...loadConfig('local'),
|
||||||
|
dev: {
|
||||||
|
...require('./config/base.json').dev,
|
||||||
|
...loadConfig(envName).dev,
|
||||||
|
...loadConfig('local').dev,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,5 +5,8 @@
|
|||||||
"paypal": {
|
"paypal": {
|
||||||
"businessId": "AD3LAUZSNVPJY",
|
"businessId": "AD3LAUZSNVPJY",
|
||||||
"buttonAction": "https://www.sandbox.paypal.com/cgi-bin/webscr"
|
"buttonAction": "https://www.sandbox.paypal.com/cgi-bin/webscr"
|
||||||
|
},
|
||||||
|
"dev": {
|
||||||
|
"allowedHosts": []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,5 +8,10 @@
|
|||||||
"paypal": {
|
"paypal": {
|
||||||
"businessId": "4ZDA7DLUUJGMN",
|
"businessId": "4ZDA7DLUUJGMN",
|
||||||
"buttonAction": "https://www.paypal.com/cgi-bin/webscr"
|
"buttonAction": "https://www.paypal.com/cgi-bin/webscr"
|
||||||
|
},
|
||||||
|
"dev": {
|
||||||
|
"proxyApi": "https://api.bitwarden.com",
|
||||||
|
"proxyIdentity": "https://identity.bitwarden.com",
|
||||||
|
"proxyEvents": "https://events.bitwarden.com"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
{
|
{
|
||||||
|
"urls": {
|
||||||
|
"notifications": "http://localhost:61840"
|
||||||
|
},
|
||||||
|
"dev": {
|
||||||
"proxyApi": "http://localhost:4000",
|
"proxyApi": "http://localhost:4000",
|
||||||
"proxyIdentity": "http://localhost:33656",
|
"proxyIdentity": "http://localhost:33656",
|
||||||
"proxyEvents": "http://localhost:46273",
|
"proxyEvents": "http://localhost:46273",
|
||||||
"proxyNotifications": "http://localhost:61840",
|
"proxyNotifications": "http://localhost:61840"
|
||||||
"allowedHosts": [],
|
|
||||||
"urls": {
|
|
||||||
"notifications": "http://localhost:61840"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,5 +2,10 @@
|
|||||||
"urls": {
|
"urls": {
|
||||||
"icons": "https://icons.qa.bitwarden.pw",
|
"icons": "https://icons.qa.bitwarden.pw",
|
||||||
"notifications": "https://notifications.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"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -169,7 +169,7 @@ const plugins = [
|
|||||||
|
|
||||||
// ref: https://webpack.js.org/configuration/dev-server/#devserver
|
// ref: https://webpack.js.org/configuration/dev-server/#devserver
|
||||||
let certSuffix = fs.existsSync('dev-server.local.pem') ? '.local' : '.shared';
|
let certSuffix = fs.existsSync('dev-server.local.pem') ? '.local' : '.shared';
|
||||||
const devServer = ENV !== 'development' ? {} : {
|
const devServer = NODE_ENV !== 'development' ? {} : {
|
||||||
https: {
|
https: {
|
||||||
key: fs.readFileSync('dev-server' + certSuffix + '.pem'),
|
key: fs.readFileSync('dev-server' + certSuffix + '.pem'),
|
||||||
cert: 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',
|
// host: '192.168.1.9',
|
||||||
proxy: {
|
proxy: {
|
||||||
'/api': {
|
'/api': {
|
||||||
target: envConfig['proxyApi'],
|
target: envConfig.dev?.proxyApi,
|
||||||
pathRewrite: {'^/api' : ''},
|
pathRewrite: {'^/api' : ''},
|
||||||
secure: false,
|
secure: false,
|
||||||
changeOrigin: true
|
changeOrigin: true
|
||||||
},
|
},
|
||||||
'/identity': {
|
'/identity': {
|
||||||
target: envConfig['proxyIdentity'],
|
target: envConfig.dev?.proxyIdentity,
|
||||||
pathRewrite: {'^/identity' : ''},
|
pathRewrite: {'^/identity' : ''},
|
||||||
secure: false,
|
secure: false,
|
||||||
changeOrigin: true
|
changeOrigin: true
|
||||||
},
|
},
|
||||||
'/events': {
|
'/events': {
|
||||||
target: envConfig['proxyEvents'],
|
target: envConfig.dev?.proxyEvents,
|
||||||
pathRewrite: {'^/events' : ''},
|
pathRewrite: {'^/events' : ''},
|
||||||
secure: false,
|
secure: false,
|
||||||
changeOrigin: true
|
changeOrigin: true
|
||||||
},
|
},
|
||||||
'/notifications': {
|
'/notifications': {
|
||||||
target: envConfig['proxyNotifications'],
|
target: envConfig.dev?.proxyNotifications,
|
||||||
pathRewrite: {'^/notifications' : ''},
|
pathRewrite: {'^/notifications' : ''},
|
||||||
secure: false,
|
secure: false,
|
||||||
changeOrigin: true
|
changeOrigin: true
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
hot: false,
|
hot: false,
|
||||||
allowedHosts: envConfig['allowedHosts']
|
allowedHosts: envConfig.dev?.allowedHosts,
|
||||||
};
|
};
|
||||||
|
|
||||||
const webpackConfig = {
|
const webpackConfig = {
|
||||||
|
Loading…
Reference in New Issue
Block a user