Skip to content

Commit

Permalink
Add support for v7
Browse files Browse the repository at this point in the history
  • Loading branch information
joachimvh committed Oct 12, 2023
1 parent c2116fe commit fc16a3f
Show file tree
Hide file tree
Showing 27 changed files with 207 additions and 100 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "community-server-configuration-generator",
"version": "6.0.0",
"version": "7.0.0",
"description": "Generates configurations for the Community Solid Server",
"author": "Joachim Van Herwegen <[email protected]>",
"license": "MIT",
Expand Down
21 changes: 21 additions & 0 deletions src/data/choices/Accounts.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { Choice } from '../Choice';

/**
* Allow registration on the server.
*/
export const ACCOUNTS = {
id: 'accounts',
label: 'Accounts',
description: `Everything related to account management.
The two final options still enable account management, but disable certain features for users.
</p><p class="text-danger"><i class="bi bi-exclamation-triangle me-1"></i>
If this is enabled anyone will be able to create new pods on your server.`,
options: [
{ value: 'default', label: 'Enabled'},
{ value: 'disabled', label: 'Disabled'},
{ value: 'no-accounts', label: 'No new accounts'},
{ value: 'no-pods', label: 'No new pods'},
{ value: 'no-accounts-pods', label: 'No new accounts and no new pods for existing accounts'},
],
default: 'default',
} as const satisfies Choice<'default' | 'disabled' | 'no-accounts' | 'no-pods' | 'no-accounts-pods'>;
2 changes: 1 addition & 1 deletion src/data/choices/Backend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const BACKEND = {
{ value: 'file', label: 'File system' },
{ value: 'sparql', label: 'SPARQL endpoint (requires in-memory internal storage)' },
{ value: 'pod-quota-file', label: 'File system (with a pod quota)' },
{ value: 'regex', label: 'SPARQL endpoint (using file system for internal data)' }
{ value: 'regex', label: 'SPARQL endpoint (using the file system for internal data)' }
],
default: 'file',
} as const satisfies Choice<'memory' | 'file' | 'sparql' | 'pod-quota-file' | 'regex'>;
25 changes: 17 additions & 8 deletions src/data/choices/InitializeRoot.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
import { BooleanOption, Choice, ENABLED_DISABLED, FALSE } from '../Choice';
import { Choice } from '../Choice';

/**
* Initialize root as storage and fully accessible (GIVES FULL ACCESS WHICH NEEDS TO BE UPDATED).
* Initialize root as storage and fully accessible (GIVES FULL ACCESS WHICH NEEDS TO BE UPDATED),
* as a pod, as a static page, or as nothing.
*/
export const INITIALIZE_ROOT = {
id: 'initializeRoot',
label: 'Initialize root',
description: `Makes the root of the server accessible for reading and writing data.
Enabling this will create the relevant authorization resources in the root that allow this.
description: `Determines what needs to happen with the root of the server.
</p><p class="text-danger"><i class="bi bi-exclamation-triangle me-1"></i>
These authorization resources provide full access to everyone so make sure to immediately update these.
The "Root pod" option creates a pod in the root with the email and password defined in the configuration.
It is advised to immediately change this password.
</p><p class="text-danger"><i class="bi bi-exclamation-triangle me-1"></i>
The "Accessible root" option writes authorization resources to the root of the server, giving full access to everyone.
It is advised to immediately update these after starting the server to prevent misuse.
They will also not disappear after stopping the server and need to be deleted manually afterwards if you use a file system as backend.
`,
options: ENABLED_DISABLED,
default: FALSE,
} as const satisfies Choice<BooleanOption>;
options: [
{ value: 'default', label: 'Inaccessible root' },
{ value: 'static-root', label: 'Static HTML page' },
{ value: 'initialize-root-pod', label: 'Root pod' },
{ value: 'initialize-root', label: 'Accessible root' },
],
default: 'static-root',
} as const satisfies Choice<'default' | 'static-root' | 'initialize-root-pod' | 'initialize-root'>;
2 changes: 1 addition & 1 deletion src/data/choices/Internal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const INTERNAL = {
Data stored in memory will be lost on server restart.`,
options: [
{ value: 'memory', label: 'In-memory' },
{ value: 'resource-store', label: 'Same as data storage (see next)' },
{ value: 'resource-store', label: 'Same as data storage' },
],
default: 'resource-store',
} as const satisfies Choice<'memory' | 'resource-store'>;
13 changes: 13 additions & 0 deletions src/data/choices/Ldp.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { BooleanOption, Choice, ENABLED_DISABLED, TRUE } from '../Choice';

/**
* Enable or disable LDP.
*/
export const LDP = {
id: 'ldp',
label: 'Solid protocol',
description: `Enables support for the core Solid protocol.
This can be disabled if you want a server that only handles OIDC and accounts.`,
options: ENABLED_DISABLED,
default: TRUE,
} as const satisfies Choice<BooleanOption>;
4 changes: 2 additions & 2 deletions src/data/choices/Notifications.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Choice, FALSE } from '../Choice';
import { Choice } from '../Choice';

/**
* Notification method(s). None if undefined.
Expand All @@ -18,5 +18,5 @@ export const NOTIFICATIONS = {
{ value: 'new-old-websockets', label: 'Current & Legacy WebSockets' },
{ value: 'disabled', label: 'Disabled' }
],
default: 'websockets',
default: 'all',
} as const satisfies Choice<'all' | 'websockets' | 'webhooks' | 'legacy-websockets' | 'new-old-websockets' | 'disabled'>;
13 changes: 13 additions & 0 deletions src/data/choices/Oidc.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { BooleanOption, Choice, ENABLED_DISABLED, TRUE } from '../Choice';

/**
* Enable or disable OIDC.
*/
export const OIDC = {
id: 'oidc',
label: 'OpenID provider',
description: `Allows the server to generate the necessary tokens and interactions for an OIDC session.
You need this if you want to use the server to log in to Solid applications.`,
options: ENABLED_DISABLED,
default: TRUE,
} as const satisfies Choice<BooleanOption>;
12 changes: 0 additions & 12 deletions src/data/choices/Registration.ts

This file was deleted.

13 changes: 0 additions & 13 deletions src/data/choices/Setup.ts

This file was deleted.

15 changes: 15 additions & 0 deletions src/data/choices/overrides/AccountHtmlTemplate.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { BooleanOption, Choice, ENABLED_DISABLED, FALSE } from '../../Choice';

/**
* The main template used for all generated HTML responses.
*/
export const ACCOUNT_HTML_TEMPLATE = {
id: 'accountHtmlTemplate',
label: 'Account HTML pages',
description: `The HTML page used when registering an email/password account on the server.
All other account HTML pages can be replaced similarly by looking in the configuration where the template file occurs.
All template files can be found
<a href="https://github.com/CommunitySolidServer/CommunitySolidServer/tree/main/templates/identity/">here</a>.`,
options: ENABLED_DISABLED,
default: FALSE,
} as const satisfies Choice<BooleanOption>;
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BooleanOption, Choice, ENABLED_DISABLED, FALSE } from '../Choice';
import { BooleanOption, Choice, ENABLED_DISABLED, FALSE } from '../../Choice';

/**
* The folder from where the pod templates will be loaded.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BooleanOption, Choice, ENABLED_DISABLED, FALSE } from '../Choice';
import { BooleanOption, Choice, ENABLED_DISABLED, FALSE } from '../../Choice';

/**
* Add template to update the lock expiration.
Expand Down
14 changes: 14 additions & 0 deletions src/data/choices/overrides/MainTemplate.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { BooleanOption, Choice, ENABLED_DISABLED, FALSE } from '../../Choice';

/**
* The main template used for all generated HTML responses.
*/
export const MAIN_TEMPLATE = {
id: 'mainTemplate',
label: 'Main HTML template',
description: `The main HTML body that is used for all HTML pages generated by the server.
See the <a href="https://github.com/CommunitySolidServer/CommunitySolidServer/blob/main/templates/main.html.ejs">original</a>
version to know what is expected.`,
options: ENABLED_DISABLED,
default: FALSE,
} as const satisfies Choice<BooleanOption>;
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BooleanOption, Choice, ENABLED_DISABLED, FALSE } from '../Choice';
import { BooleanOption, Choice, ENABLED_DISABLED, FALSE } from '../../Choice';

/**
* The folder from where the pod templates will be loaded.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BooleanOption, Choice, ENABLED_DISABLED, FALSE } from '../Choice';
import { BooleanOption, Choice, ENABLED_DISABLED, FALSE } from '../../Choice';

/**
* Add template to update the OIDC configuration settings. Probably only interested in the timeouts though.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BooleanOption, Choice, ENABLED_DISABLED, FALSE } from '../Choice';
import { BooleanOption, Choice, ENABLED_DISABLED, FALSE } from '../../Choice';

/**
* The folder from where the pod templates will be loaded.
Expand All @@ -7,11 +7,8 @@ export const POD_TEMPLATE = {
id: 'podTemplate',
label: 'Pod template folder',
description: `The path to the folder that contains the templates that are used to instantiate a new pod.
The path is relative to where the Node.js process is executed from,
or, if it starts with <code>@css:</code>, relative to the install location of CSS.
HandleBars is used to interpret the templates.</p>
<p>The WebID is always expected to be in <code>profile/card#me</code>.
The folder is expected to have separate folders to differentiate between the chosen authorization systems,
The folder at the path location is expected to have separate folders to differentiate between the chosen authorization systems,
see the original <a href="https://github.com/CommunitySolidServer/CommunitySolidServer/tree/main/templates/pod">templates</a> for an example.`,
options: ENABLED_DISABLED,
default: FALSE,
Expand Down
6 changes: 2 additions & 4 deletions src/data/data.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import { Choice } from './Choice';
import { Group } from './Group';
import { ACCOUNT_MANAGEMENT } from './groups/AccountManagement';
import { ADVANCED } from './groups/Advanced';
import { DATA } from './groups/Data';
import { MISC } from './groups/Misc';
import { PARAMETERS } from './groups/Parameters';
import { PODS } from './groups/Pods';
import { SECURITY } from './groups/Security';

export const GROUPS = [
DATA,
SECURITY,
PODS,
ACCOUNT_MANAGEMENT,
MISC,
ADVANCED,
PARAMETERS,
Expand Down
14 changes: 8 additions & 6 deletions src/data/groups/Pods.ts → src/data/groups/AccountManagement.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import { Choice } from '../Choice';
import { ACCOUNTS } from '../choices/Accounts';
import { EMAIL } from '../choices/Email';
import { REGISTRATION } from '../choices/Registration';
import { OIDC } from '../choices/Oidc';
import { SUBDOMAIN } from '../choices/Subdomain';
import { Group } from '../Group';

export const PODS = {
id: 'pods',
label: 'Pod management',
description: 'Everything related to registering and creating new pods on the server.',
export const ACCOUNT_MANAGEMENT = {
id: 'account-management',
label: 'Account management',
description: 'Everything related to registering and creating new accounts and pods on the server.',
entries: [
REGISTRATION,
ACCOUNTS,
EMAIL,
SUBDOMAIN,
OIDC,
],
} as const satisfies Group<Choice>;
8 changes: 6 additions & 2 deletions src/data/groups/Data.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
import { Choice } from '../Choice';
import { AUTHORIZATION } from '../choices/Authorization';
import { BACKEND } from '../choices/Backend';
import { INTERNAL } from '../choices/Internal';
import { LDP } from '../choices/Ldp';
import { LOCKING } from '../choices/Locking';
import { Group } from '../Group';

export const DATA = {
id: 'data',
label: 'Data management',
description: 'All options related to where data is stored.',
description: 'All options related to how data is stored.',
entries: [
INTERNAL,
BACKEND,
AUTHORIZATION,
LDP,
INTERNAL,
LOCKING,
],
} as const satisfies Group<Choice>;
4 changes: 2 additions & 2 deletions src/data/groups/Misc.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Choice } from '../Choice';
import { HTTPS } from '../choices/Https';
import { INITIALIZE_ROOT } from '../choices/InitializeRoot';
import { NOTIFICATIONS } from '../choices/Notifications';
import { SETUP } from '../choices/Setup';
import { Group } from '../Group';

export const MISC = {
Expand All @@ -11,6 +11,6 @@ export const MISC = {
entries: [
NOTIFICATIONS,
INITIALIZE_ROOT,
SETUP,
HTTPS,
],
} as const satisfies Group<Choice>;
17 changes: 12 additions & 5 deletions src/data/groups/Parameters.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { Choice } from '../Choice';
import { CONTAINER_INDEX } from '../choices/ContainerIndex';
import { LOCK_EXPIRATION } from '../choices/LockExpiration';
import { NOTIFICATION_DURATION } from '../choices/NotificationDuration';
import { OIDC_CONFIGURATION } from '../choices/OidcConfiguration';
import { POD_TEMPLATE } from '../choices/PodTemplate';
import { ACCOUNT_HTML_TEMPLATE } from '../choices/overrides/AccountHtmlTemplate';
import { CONTAINER_INDEX } from '../choices/overrides/ContainerIndex';
import { LOCK_EXPIRATION } from '../choices/overrides/LockExpiration';
import { MAIN_TEMPLATE } from '../choices/overrides/MainTemplate';
import { NOTIFICATION_DURATION } from '../choices/overrides/NotificationDuration';
import { OIDC_CONFIGURATION } from '../choices/overrides/OidcConfiguration';
import { POD_TEMPLATE } from '../choices/overrides/PodTemplate';
import { Group } from '../Group';

export const PARAMETERS = {
Expand All @@ -14,6 +16,9 @@ export const PARAMETERS = {
which you can use to update the necessary values in the <code>overrideParameters</code> block.</p>
<p>These options are only relevant for specific use cases.
If you are not sure, you can safely leave them all disabled and the default values will be used.</p>
<p>Several of these options allow you to provide a path to a file.
This path is always relative to where the Node.js process is executed from,
or, if it starts with <code>@css:</code>, relative to the install location of CSS.</p>
<p>The options below are just some of the parameters that can be customized,
chosen based on what might be useful for people wanting to configure their server.
If there is another value that you want to customize,
Expand All @@ -24,6 +29,8 @@ export const PARAMETERS = {
LOCK_EXPIRATION,
CONTAINER_INDEX,
POD_TEMPLATE,
MAIN_TEMPLATE,
ACCOUNT_HTML_TEMPLATE,
OIDC_CONFIGURATION,
],
} as const satisfies Group<Choice>;
14 changes: 0 additions & 14 deletions src/data/groups/Security.ts

This file was deleted.

Loading

0 comments on commit fc16a3f

Please sign in to comment.