Skip to content

Commit d7411eb

Browse files
Expand SolidHost config constructor, plus tests
1 parent 217e8e3 commit d7411eb

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

lib/create-app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ function createApp (argv = {}) {
4242
// Override default configs (defaults) with passed-in params (argv)
4343
argv = Object.assign({}, defaults, argv)
4444

45-
argv.host = SolidHost.from({ port: argv.port, serverUri: argv.serverUri })
45+
argv.host = SolidHost.from(argv)
4646

4747
argv.resourceMapper = new ResourceMapper({
4848
rootUrl: argv.serverUri,

lib/models/solid-host.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,12 @@ class SolidHost {
1515
* @param [options={}]
1616
* @param [options.port] {number}
1717
* @param [options.serverUri] {string} Fully qualified URI that this Solid
18-
* server is listening on, e.g. `https://databox.me`
18+
* server is listening on, e.g. `https://solid.community`
19+
* @param [options.live] {boolean} Whether to turn on WebSockets / LDP live
20+
* @param [options.root] {string} Path to root data directory
21+
* @param [options.multiuser] {boolean} Multiuser mode
22+
* @param [options.webid] {boolean} Enable WebID-related functionality
23+
* (account creation and authentication)
1924
*/
2025
constructor (options = {}) {
2126
this.port = options.port || defaults.port
@@ -24,6 +29,10 @@ class SolidHost {
2429
this.parsedUri = url.parse(this.serverUri)
2530
this.host = this.parsedUri.host
2631
this.hostname = this.parsedUri.hostname
32+
this.live = options.live
33+
this.root = options.root
34+
this.multiuser = options.multiuser
35+
this.webid = options.webid
2736
}
2837

2938
/**

test/unit/solid-host-test.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,24 @@ const defaults = require('../../config/defaults')
77

88
describe('SolidHost', () => {
99
describe('from()', () => {
10-
it('should init with port, serverUri and hostname', () => {
10+
it('should init with provided params', () => {
1111
let config = {
1212
port: 3000,
13-
serverUri: 'https://localhost:3000'
13+
serverUri: 'https://localhost:3000',
14+
live: true,
15+
root: '/data/solid/',
16+
multiuser: true,
17+
webid: true
1418
}
1519
let host = SolidHost.from(config)
1620

1721
expect(host.port).to.equal(3000)
1822
expect(host.serverUri).to.equal('https://localhost:3000')
1923
expect(host.hostname).to.equal('localhost')
24+
expect(host.live).to.be.true
25+
expect(host.root).to.equal('/data/solid/')
26+
expect(host.multiuser).to.be.true
27+
expect(host.webid).to.be.true
2028
})
2129

2230
it('should init to default port and serverUri values', () => {

0 commit comments

Comments
 (0)