Skip to content

Commit

Permalink
Changes to ports.json configuration for Wire
Browse files Browse the repository at this point in the history
Rather than using the `wireHTTP` property to specify which port Wire should use for HTTP, a `wire` object with an `HTTP` property is now used. A `HTTPS` property has also been added to defaults/prefs/ports.json, although Wire does not yet support HTTPS.
This commit also changes the documentation for the ports.json file to use the sphinxjsondomain extension.
  • Loading branch information
ZelnickB committed Aug 24, 2020
1 parent 5589497 commit eb303be
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
5 changes: 4 additions & 1 deletion defaults/prefs/ports.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{
"wireHTTP": 80
"wire": {
"HTTP": 80,
"HTTPS": 443
}
}
13 changes: 9 additions & 4 deletions docs/general/ports.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@
The ports.json file
*******************

The ``ports.json`` file, located at ``/prefs/ports.json`` determines which ports Aluminum uses for different features. The acceptable keys and values are listed below. All values must be of type ``Number``.
The ``ports.json`` file, located at ``/prefs/ports.json`` determines which ports Aluminum uses for different features. The file contains a single ``aluminumPorts`` object, described below.

A default configuration of ``ports.json`` is located at ``/defaults/prefs/ports.json``.

.. describe:: "wireHTTP"
.. json:object:: aluminumPorts
| The port to use for Aluminum Wire over HTTP.
| **Default:** 80
:property wire: Ports for Aluminum Wire
:proptype wire: :json:object:`wirePorts`

.. json:object:: wirePorts
:property Number HTTP: Port to use for Aluminum Wire over HTTP
:property Number HTTPS: Port to use for Aluminum Wire over HTTPS
4 changes: 2 additions & 2 deletions src/wire/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const os = require('os') // For retrieving operating system information (for err
const path = require('path') // For manipulating request paths
const mimeTypes = require('mime-types') // For sending the correct Content-Type HTTP header

const ports = JSON.parse(fs.readFileSync('../../prefs/ports.json', 'utf8'))
const ports = JSON.parse(fs.readFileSync('../../prefs/ports.json', 'utf8')).wire
const errorPage = fs.readFileSync('../../defaults/errors/404.html', 'utf8') // Default error page content
const logo = fs.readFileSync('../../logo.svg', 'utf8')

Expand Down Expand Up @@ -66,4 +66,4 @@ function serverHandler (req, res) {
}

const server = http.createServer(serverHandler)
server.listen(ports.wireHTTP)
server.listen(ports.HTTP)

0 comments on commit eb303be

Please sign in to comment.