Skip to content

Commit c2463bc

Browse files
RubenVerborghdmitrizagidulin
authored andcommitted
Rename proxy to corsProxy.
Making room for the authProxy option.
1 parent 42011d6 commit c2463bc

File tree

6 files changed

+22
-12
lines changed

6 files changed

+22
-12
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
- [x] [WebID+TLS Authentication](https://www.w3.org/2005/Incubator/webid/spec/tls/)
1616
- [x] [Real-time live updates](https://github.com/solid/solid-spec#subscribing) (using WebSockets)
1717
- [x] Identity provider for WebID
18-
- [x] Proxy for cross-site data access
18+
- [x] CORS proxy for cross-site data access
1919
- [ ] Group members in ACL
2020
- [x] Email account recovery
2121

@@ -154,7 +154,7 @@ $ solid start --help
154154
--ssl-key [value] Path to the SSL private key in PEM format
155155
--ssl-cert [value] Path to the SSL certificate key in PEM format
156156
--idp Enable multi-user mode (users can sign up for accounts)
157-
--proxy [value] Serve proxy on path (default: '/proxy')
157+
--corsProxy [value] Serve the CORS proxy on this path
158158
--file-browser [value] Url to file browser app (uses Warp by default)
159159
--data-browser Enable viewing RDF resources using a default data browser application (e.g. mashlib)
160160
--suffix-acl [value] Suffix for acl files (default: '.acl')
@@ -198,7 +198,7 @@ default settings.
198198
mount: '/', // Where to mount Linked Data Platform
199199
webid: false, // Enable WebID+TLS authentication
200200
suffixAcl: '.acl', // Suffix for acl files
201-
proxy: false, // Where to mount the proxy
201+
corsProxy: false, // Where to mount the CORS proxy
202202
errorHandler: false, // function(err, req, res, next) to have a custom error handler
203203
errorPages: false // specify a path where the error pages are
204204
}

bin/lib/options.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,17 +135,22 @@ module.exports = [
135135
// help: 'URI to use as a default app for resources (default: https://linkeddata.github.io/warp/#/list/)'
136136
// },
137137
{
138-
name: 'useProxy',
138+
name: 'useCorsProxy',
139139
help: 'Do you want to have a CORS proxy endpoint?',
140140
flag: true,
141141
prompt: true,
142142
hide: true
143143
},
144144
{
145145
name: 'proxy',
146-
help: 'Serve proxy on path',
146+
help: 'Obsolete; use --corsProxy',
147+
prompt: false
148+
},
149+
{
150+
name: 'corsProxy',
151+
help: 'Serve the CORS proxy on this path',
147152
when: function (answers) {
148-
return answers.useProxy
153+
return answers.useCorsProxy
149154
},
150155
default: '/proxy',
151156
prompt: true

lib/create-app.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const uuid = require('uuid')
77
const cors = require('cors')
88
const LDP = require('./ldp')
99
const LdpMiddleware = require('./ldp-middleware')
10-
const proxy = require('./handlers/proxy')
10+
const corsProxy = require('./handlers/cors-proxy')
1111
const SolidHost = require('./models/solid-host')
1212
const AccountManager = require('./models/account-manager')
1313
const vhost = require('vhost')
@@ -54,7 +54,12 @@ function createApp (argv = {}) {
5454

5555
// Adding proxy
5656
if (argv.proxy) {
57-
proxy(app, argv.proxy)
57+
console.error('The proxy configuration option has been renamed to corsProxy.')
58+
argv.corsProxy = argv.proxy
59+
delete argv.proxy
60+
}
61+
if (argv.corsProxy) {
62+
corsProxy(app, argv.corsProxy)
5863
}
5964

6065
// Options handler

lib/ldp.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ class LDP {
7575
this.skin = true
7676
}
7777

78-
if (this.proxy && this.proxy[ 0 ] !== '/') {
79-
this.proxy = '/' + this.proxy
78+
if (this.corsProxy && this.corsProxy[ 0 ] !== '/') {
79+
this.corsProxy = '/' + this.corsProxy
8080
}
8181

8282
debug.settings('Server URI: ' + this.serverUri)
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ var async = require('async')
66

77
var ldnode = require('../../index')
88

9-
describe('proxy', () => {
9+
describe('CORS Proxy', () => {
1010
var ldp = ldnode({
1111
root: path.join(__dirname, '../resources'),
12-
proxy: '/proxy',
12+
corsProxy: '/proxy',
1313
webid: false
1414
})
1515
var server = supertest(ldp)

0 commit comments

Comments
 (0)