Skip to content

Commit 9dcba1a

Browse files
committed
refactor: Add imports that allow for HTTPS through CLI params
1 parent ca36d86 commit 9dcba1a

7 files changed

+121
-82
lines changed

RELEASE_NOTES.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,12 @@ The following changes pertain to the imports in the default configs:
2424
- The prefix of all imports was changed from `files-scs` to `css`.
2525
- All default configurations with a file-based backend now use a file-based locker instead of a memory-based one,
2626
making them threadsafe.
27+
- 2 new options have been added for the `/http/server-factory/` imports: `https-websockets.json` and `https-no-websockets.json`,
28+
which allow starting the server with HTTPS by adding 2 new CLI parameters `httpsKey` and `httpsCert`.
2729

2830
The following changes are relevant for v4 custom configs that replaced certain features.
29-
- `config/app/variables/*` was changed to support the new `YargsCliExtractor` format and `SettingsResolver` rename.
30-
- `config/util/resource-locker/memory.json` had the locker @type changed from `SingleThreadedResourceLocker` to `MemoryResourceLocker`.
31+
- `/app/variables/*` was changed to support the new `YargsCliExtractor` format and `SettingsResolver` rename.
32+
- `/util/resource-locker/memory.json` had the locker @type changed from `SingleThreadedResourceLocker` to `MemoryResourceLocker`.
3133
- The content-length parser has been moved from the default configuration to the quota configurations.
3234
- `/ldp/metadata-parser/default.json`
3335
- `/storage/backend/*-quota-file.json`

config/http/README.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ and then pass the request along.
1616
The factory used to create the actual server object.
1717
* *no-websockets*: Only HTTP.
1818
* *websockets*: HTTP and websockets.
19-
* *https-example*: An example configuration to use HTTPS directly at the server (instead of at a reverse proxy).
19+
* *https-no-websockets*: Only HTTPS. Adds 2 new CLI params to set the key/cert paths.
20+
* *https-websockets*: HTTPS and websockets. Adds 2 new CLI params to set the key/cert paths.
21+
* *https-example*: An example configuration to use HTTPS directly at the server (instead of at a reverse proxy)
22+
by adding the key/cert paths to the config itself.
2023

2124
## Static
2225
Support for static files that should be found at a specific path.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"@context": "https://linkedsoftwaredependencies.org/bundles/npm/@solid/community-server/^5.0.0/components/context.jsonld",
3+
"@graph": [
4+
{
5+
"comment": "Creates a server that supports HTTPS requests.",
6+
"@id": "urn:solid-server:default:ServerFactory",
7+
"@type": "BaseHttpServerFactory",
8+
"handler": { "@id": "urn:solid-server:default:HttpHandler" },
9+
"options_showStackTrace": { "@id": "urn:solid-server:default:variable:showStackTrace" },
10+
"options_https": true,
11+
"options_key": {
12+
"@id": "urn:solid-server:custom:variable:httpsKey",
13+
"@type": "Variable"
14+
},
15+
"options_cert": {
16+
"@id": "urn:solid-server:custom:variable:httpsCert",
17+
"@type": "Variable"
18+
}
19+
}
20+
]
21+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"@context": "https://linkedsoftwaredependencies.org/bundles/npm/@solid/community-server/^5.0.0/components/context.jsonld",
3+
"import": [
4+
"css:config/http/server-factory/https/cli.json",
5+
"css:config/http/server-factory/https/resolver.json"
6+
],
7+
"@graph": [
8+
{
9+
"comment": "Creates an HTTPS server with the settings provided via the command line.",
10+
"@id": "urn:solid-server:default:ServerFactory",
11+
"@type": "WebSocketServerFactory",
12+
"baseServerFactory": {
13+
"@id": "urn:solid-server:default:HttpServerFactory",
14+
"@type": "BaseHttpServerFactory",
15+
"handler": { "@id": "urn:solid-server:default:HttpHandler" },
16+
"options_showStackTrace": { "@id": "urn:solid-server:default:variable:showStackTrace" },
17+
"options_https": true,
18+
"options_key": {
19+
"@id": "urn:solid-server:custom:variable:httpsKey",
20+
"@type": "Variable"
21+
},
22+
"options_cert": {
23+
"@id": "urn:solid-server:custom:variable:httpsCert",
24+
"@type": "Variable"
25+
}
26+
},
27+
"webSocketHandler": {
28+
"@type": "UnsecureWebSocketsProtocol",
29+
"source": { "@id": "urn:solid-server:default:ResourceStore" }
30+
}
31+
}
32+
]
33+
}
+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"@context": "https://linkedsoftwaredependencies.org/bundles/npm/@solid/community-server/^5.0.0/components/context.jsonld",
3+
"@graph": [
4+
{
5+
"@id": "urn:solid-server-app-setup:default:CliExtractor",
6+
"@type": "YargsCliExtractor",
7+
"parameters": [
8+
{
9+
"@type": "YargsParameter",
10+
"name": "httpsKey",
11+
"options": {
12+
"demandOption": true,
13+
"requiresArg": true,
14+
"type": "string",
15+
"describe": "File path to the HTTPS key."
16+
}
17+
},
18+
{
19+
"@type": "YargsParameter",
20+
"name": "httpsCert",
21+
"options": {
22+
"demandOption": true,
23+
"requiresArg": true,
24+
"type": "string",
25+
"describe": "File path to the HTTPS certificate."
26+
}
27+
}
28+
]
29+
}
30+
]
31+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"@context": "https://linkedsoftwaredependencies.org/bundles/npm/@solid/community-server/^5.0.0/components/context.jsonld",
3+
"@graph": [
4+
{
5+
"comment": "Adds resolvers to assign the HTTPS CLI values to the Components.js variables.",
6+
"@id": "urn:solid-server-app-setup:default:ShorthandResolver",
7+
"@type": "CombinedShorthandResolver",
8+
"resolvers": [
9+
{
10+
"CombinedShorthandResolver:_resolvers_key": "urn:solid-server:custom:variable:httpsKey",
11+
"CombinedShorthandResolver:_resolvers_value": {
12+
"@type": "KeyExtractor",
13+
"key": "httpsKey"
14+
}
15+
},
16+
{
17+
"CombinedShorthandResolver:_resolvers_key": "urn:solid-server:custom:variable:httpsCert",
18+
"CombinedShorthandResolver:_resolvers_value": {
19+
"@type": "KeyExtractor",
20+
"key": "httpsCert"
21+
}
22+
}
23+
]
24+
}
25+
]
26+
}

config/https-file-cli.json

+2-79
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"css:config/app/variables/default.json",
88
"css:config/http/handler/default.json",
99
"css:config/http/middleware/websockets.json",
10-
10+
"css:config/http/server-factory/https-websockets.json",
1111
"css:config/http/static/default.json",
1212
"css:config/identity/access/public.json",
1313
"css:config/identity/email/default.json",
@@ -34,84 +34,7 @@
3434
],
3535
"@graph": [
3636
{
37-
"comment": [
38-
"Adds CLI options --httpsKey and --httpsCert and uses those to start an HTTPS server.",
39-
"The http/server-factory import above has been omitted since that feature is set below."
40-
]
41-
},
42-
{
43-
"@id": "urn:solid-server-app-setup:default:CliExtractor",
44-
"@type": "YargsCliExtractor",
45-
"parameters": [
46-
{
47-
"@type": "YargsParameter",
48-
"name": "httpsKey",
49-
"options": {
50-
"demandOption": true,
51-
"requiresArg": true,
52-
"type": "string",
53-
"describe": "File path to the HTTPS key."
54-
}
55-
},
56-
{
57-
"@type": "YargsParameter",
58-
"name": "httpsCert",
59-
"options": {
60-
"demandOption": true,
61-
"requiresArg": true,
62-
"type": "string",
63-
"describe": "File path to the HTTPS certificate."
64-
}
65-
}
66-
]
67-
},
68-
{
69-
"comment": "Adds resolvers to assign the CLI values to the Components.js variables.",
70-
"@id": "urn:solid-server-app-setup:default:ShorthandResolver",
71-
"@type": "CombinedShorthandResolver",
72-
"resolvers": [
73-
{
74-
"CombinedShorthandResolver:_resolvers_key": "urn:solid-server:custom:variable:httpsKey",
75-
"CombinedShorthandResolver:_resolvers_value": {
76-
"@type": "KeyExtractor",
77-
"key": "httpsKey"
78-
}
79-
},
80-
{
81-
"CombinedShorthandResolver:_resolvers_key": "urn:solid-server:custom:variable:httpsCert",
82-
"CombinedShorthandResolver:_resolvers_value": {
83-
"@type": "KeyExtractor",
84-
"key": "httpsCert"
85-
}
86-
}
87-
]
88-
},
89-
{
90-
"comment": [
91-
"Creates an HTTPS server with the settings provided via the command line.",
92-
"Replaces the example import from config/http/server-factory.https-example.json."
93-
],
94-
"@id": "urn:solid-server:default:ServerFactory",
95-
"@type": "WebSocketServerFactory",
96-
"baseServerFactory": {
97-
"@id": "urn:solid-server:default:HttpServerFactory",
98-
"@type": "BaseHttpServerFactory",
99-
"handler": { "@id": "urn:solid-server:default:HttpHandler" },
100-
"options_showStackTrace": { "@id": "urn:solid-server:default:variable:showStackTrace" },
101-
"options_https": true,
102-
"options_key": {
103-
"@id": "urn:solid-server:custom:variable:httpsKey",
104-
"@type": "Variable"
105-
},
106-
"options_cert": {
107-
"@id": "urn:solid-server:custom:variable:httpsCert",
108-
"@type": "Variable"
109-
}
110-
},
111-
"webSocketHandler": {
112-
"@type": "UnsecureWebSocketsProtocol",
113-
"source": { "@id": "urn:solid-server:default:ResourceStore" }
114-
}
37+
"comment": "Adds CLI options --httpsKey and --httpsCert and uses those to start an HTTPS server."
11538
}
11639
]
11740
}

0 commit comments

Comments
 (0)