mirror of
https://github.com/urbit/shrub.git
synced 2024-12-25 04:52:06 +03:00
interface: multi ship devserver
This commit is contained in:
parent
8a1c6f6243
commit
6855f623de
@ -39,6 +39,31 @@ npm run start
|
||||
The dev server will start at `http://localhost:9000`. Sign in as you would
|
||||
normally. Landscape will refresh automatically as you make changes.
|
||||
|
||||
#### Multi ship environments
|
||||
|
||||
If you are testing across multiple ships at once, and you would like to be able
|
||||
to run the development server against all of the ships simulataneously, then do
|
||||
the following.
|
||||
|
||||
Add an object under the `FLEET` key to your urbitrc.
|
||||
```javascript
|
||||
module.exports = {
|
||||
URL: 'http://localhost:80',
|
||||
FLEET: {
|
||||
'zod': 'http://localhost:8080',
|
||||
'bus': 'http://localhost:8081',
|
||||
'nus': 'http://localhost:8082'
|
||||
}
|
||||
};
|
||||
|
||||
```
|
||||
|
||||
The dev environment will attempt to match the subdomain against the keys of this
|
||||
object, and if matched will proxy to the corresponding URL. For example, the
|
||||
above config will proxy `zod.localhost:9000` to `http://localhost:8080`,
|
||||
`bus.localhost:9000` to `http://localhost:8081` and so on and so forth. If no
|
||||
match is found, then it will fallback to the `URL` property.
|
||||
|
||||
## Linting
|
||||
|
||||
The Urbit interface uses Eslint to lint the JavaScript code. To install the
|
||||
@ -70,4 +95,4 @@ running.
|
||||
[cla]: https://github.com/urbit/create-landscape-app
|
||||
[template]: https://github.com/urbit/create-landscape-app/generate
|
||||
[gall]:https://urbit.org/docs/learn/arvo/gall/
|
||||
[local]: /CONTRIBUTING.md#fake-ships
|
||||
[local]: /CONTRIBUTING.md#fake-ships
|
||||
|
@ -3,5 +3,9 @@ module.exports = {
|
||||
"/Users/user/ships/zod/home",
|
||||
],
|
||||
herb: false,
|
||||
URL: 'http://localhost:80'
|
||||
URL: 'http://localhost:80',
|
||||
/* FLEET: {
|
||||
'zod': "http://localhost:8080',
|
||||
'bus': 'http://localhost:8081'
|
||||
} */
|
||||
};
|
||||
|
@ -4,6 +4,7 @@ const path = require('path');
|
||||
const urbitrc = require('./urbitrc');
|
||||
const fs = require('fs');
|
||||
const util = require('util');
|
||||
const _ = require('lodash');
|
||||
const exec = util.promisify(require('child_process').exec);
|
||||
|
||||
function copyFile(src,dest) {
|
||||
@ -49,6 +50,8 @@ let devServer = {
|
||||
historyApiFallback: true
|
||||
};
|
||||
|
||||
const router = _.mapKeys(urbitrc.FLEET || {}, (value, key) => `${key}.localhost:9000`);
|
||||
|
||||
if(urbitrc.URL) {
|
||||
devServer = {
|
||||
...devServer,
|
||||
@ -56,13 +59,17 @@ if(urbitrc.URL) {
|
||||
proxy: {
|
||||
'/~landscape/js/bundle/index.*.js': {
|
||||
target: 'http://localhost:9000',
|
||||
pathRewrite: (req, path) => '/index.js'
|
||||
pathRewrite: (req, path) => {
|
||||
return '/index.js'
|
||||
}
|
||||
},
|
||||
'**': {
|
||||
changeOrigin: true,
|
||||
target: urbitrc.URL,
|
||||
router,
|
||||
// ensure proxy doesn't timeout channels
|
||||
proxyTimeout: 0
|
||||
}
|
||||
proxyTimeout: 0,
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user