From 797e804c0770a47cdf5c86ea17318cada26c3004 Mon Sep 17 00:00:00 2001 From: Joachim Van Herwegen Date: Fri, 12 Feb 2021 15:52:53 +0100 Subject: [PATCH] feat: Add config presets for subdomain support --- config/config-default.json | 1 + config/config-file-subdomains.json | 35 +++++++++++++++++ config/config-file.json | 1 + config/config-memory-subdomains.json | 35 +++++++++++++++++ config/config-path-routing.json | 1 + config/config-rdf-to-sparql-endpoint.json | 1 + config/config-sparql-endpoint.json | 1 + .../identifiers/subdomain-identifiers.json | 19 ++++++++++ .../identifiers/suffix-identifiers.json | 19 ++++++++++ config/presets/pod-management.json | 5 +-- config/presets/storage-wrapper.json | 8 ---- .../storage-filesystem-subdomains.json | 38 +++++++++++++++++++ test/integration/config/ldp-with-auth.json | 1 + test/integration/config/server-memory.json | 1 + .../config/server-without-auth.json | 1 + 15 files changed, 155 insertions(+), 12 deletions(-) create mode 100644 config/config-file-subdomains.json create mode 100644 config/config-memory-subdomains.json create mode 100644 config/presets/identifiers/subdomain-identifiers.json create mode 100644 config/presets/identifiers/suffix-identifiers.json create mode 100644 config/presets/storage/backend/storage-filesystem-subdomains.json diff --git a/config/config-default.json b/config/config-default.json index 2e05b7501..2d000847d 100644 --- a/config/config-default.json +++ b/config/config-default.json @@ -3,6 +3,7 @@ "import": [ "files-scs:config/presets/acl.json", "files-scs:config/presets/http.json", + "files-scs:config/presets/identifiers/suffix-identifiers.json", "files-scs:config/presets/init.json", "files-scs:config/presets/ldp.json", "files-scs:config/presets/ldp/credentials-extractor.json", diff --git a/config/config-file-subdomains.json b/config/config-file-subdomains.json new file mode 100644 index 000000000..03419475f --- /dev/null +++ b/config/config-file-subdomains.json @@ -0,0 +1,35 @@ +{ + "@context": "https://linkedsoftwaredependencies.org/bundles/npm/@solid/community-server/^0.0.0/components/context.jsonld", + "import": [ + "files-scs:config/presets/acl.json", + "files-scs:config/presets/http.json", + "files-scs:config/presets/identifiers/subdomain-identifiers.json", + "files-scs:config/presets/init.json", + "files-scs:config/presets/ldp.json", + "files-scs:config/presets/ldp/credentials-extractor.json", + "files-scs:config/presets/ldp/metadata-handler.json", + "files-scs:config/presets/ldp/operation-handler.json", + "files-scs:config/presets/ldp/permissions-extractor.json", + "files-scs:config/presets/ldp/response-writer.json", + "files-scs:config/presets/ldp/request-parser.json", + "files-scs:config/presets/ldp/websockets.json", + "files-scs:config/presets/logging.json", + "files-scs:config/presets/middleware.json", + "files-scs:config/presets/pod-management.json", + "files-scs:config/presets/representation-conversion.json", + "files-scs:config/presets/static.json", + "files-scs:config/presets/storage/backend/storage-filesystem-subdomains.json", + "files-scs:config/presets/storage-wrapper.json", + "files-scs:config/presets/cli-params.json" + ], + "@graph": [ + { + "comment": "Use a file based store as backend with no additional routing.", + "@id": "urn:solid-server:default:RoutingResourceStore", + "@type": "PassthroughStore", + "PassthroughStore:_source": { + "@id": "urn:solid-server:default:FileResourceStore" + } + } + ] +} diff --git a/config/config-file.json b/config/config-file.json index 03e140e9c..6424a5b36 100644 --- a/config/config-file.json +++ b/config/config-file.json @@ -3,6 +3,7 @@ "import": [ "files-scs:config/presets/acl.json", "files-scs:config/presets/http.json", + "files-scs:config/presets/identifiers/suffix-identifiers.json", "files-scs:config/presets/init.json", "files-scs:config/presets/ldp.json", "files-scs:config/presets/ldp/credentials-extractor.json", diff --git a/config/config-memory-subdomains.json b/config/config-memory-subdomains.json new file mode 100644 index 000000000..18dc33553 --- /dev/null +++ b/config/config-memory-subdomains.json @@ -0,0 +1,35 @@ +{ + "@context": "https://linkedsoftwaredependencies.org/bundles/npm/@solid/community-server/^0.0.0/components/context.jsonld", + "import": [ + "files-scs:config/presets/acl.json", + "files-scs:config/presets/http.json", + "files-scs:config/presets/identifiers/subdomain-identifiers.json", + "files-scs:config/presets/init.json", + "files-scs:config/presets/ldp.json", + "files-scs:config/presets/ldp/credentials-extractor.json", + "files-scs:config/presets/ldp/metadata-handler.json", + "files-scs:config/presets/ldp/operation-handler.json", + "files-scs:config/presets/ldp/permissions-extractor.json", + "files-scs:config/presets/ldp/response-writer.json", + "files-scs:config/presets/ldp/request-parser.json", + "files-scs:config/presets/ldp/websockets.json", + "files-scs:config/presets/logging.json", + "files-scs:config/presets/middleware.json", + "files-scs:config/presets/pod-management.json", + "files-scs:config/presets/representation-conversion.json", + "files-scs:config/presets/static.json", + "files-scs:config/presets/storage/backend/storage-memory.json", + "files-scs:config/presets/storage-wrapper.json", + "files-scs:config/presets/cli-params.json" + ], + "@graph": [ + { + "comment": "Use a memory based store as backend with no additional routing.", + "@id": "urn:solid-server:default:RoutingResourceStore", + "@type": "PassthroughStore", + "PassthroughStore:_source": { + "@id": "urn:solid-server:default:MemoryResourceStore" + } + } + ] +} diff --git a/config/config-path-routing.json b/config/config-path-routing.json index 1f0c804f9..ad18b0630 100644 --- a/config/config-path-routing.json +++ b/config/config-path-routing.json @@ -3,6 +3,7 @@ "import": [ "files-scs:config/presets/acl.json", "files-scs:config/presets/http.json", + "files-scs:config/presets/identifiers/suffix-identifiers.json", "files-scs:config/presets/init.json", "files-scs:config/presets/ldp.json", "files-scs:config/presets/ldp/credentials-extractor.json", diff --git a/config/config-rdf-to-sparql-endpoint.json b/config/config-rdf-to-sparql-endpoint.json index f7b6acf24..8368b5b07 100644 --- a/config/config-rdf-to-sparql-endpoint.json +++ b/config/config-rdf-to-sparql-endpoint.json @@ -3,6 +3,7 @@ "import": [ "files-scs:config/presets/acl.json", "files-scs:config/presets/http.json", + "files-scs:config/presets/identifiers/suffix-identifiers.json", "files-scs:config/presets/init.json", "files-scs:config/presets/ldp.json", "files-scs:config/presets/ldp/credentials-extractor.json", diff --git a/config/config-sparql-endpoint.json b/config/config-sparql-endpoint.json index be0edf08f..cc87cba1b 100644 --- a/config/config-sparql-endpoint.json +++ b/config/config-sparql-endpoint.json @@ -3,6 +3,7 @@ "import": [ "files-scs:config/presets/acl.json", "files-scs:config/presets/http.json", + "files-scs:config/presets/identifiers/suffix-identifiers.json", "files-scs:config/presets/init.json", "files-scs:config/presets/ldp.json", "files-scs:config/presets/ldp/credentials-extractor.json", diff --git a/config/presets/identifiers/subdomain-identifiers.json b/config/presets/identifiers/subdomain-identifiers.json new file mode 100644 index 000000000..f92223e4d --- /dev/null +++ b/config/presets/identifiers/subdomain-identifiers.json @@ -0,0 +1,19 @@ +{ + "@context": "https://linkedsoftwaredependencies.org/bundles/npm/@solid/community-server/^0.0.0/components/context.jsonld", + "@graph": [ + { + "@id": "urn:solid-server:default:IdentifierStrategy", + "@type": "SubdomainIdentifierStrategy", + "SubdomainIdentifierStrategy:_baseUrl": { + "@id": "urn:solid-server:default:variable:baseUrl" + } + }, + { + "@id": "urn:solid-server:default:IdentifierGenerator", + "@type": "SubdomainIdentifierGenerator", + "SubdomainIdentifierGenerator:_baseUrl": { + "@id": "urn:solid-server:default:variable:baseUrl" + } + } + ] +} diff --git a/config/presets/identifiers/suffix-identifiers.json b/config/presets/identifiers/suffix-identifiers.json new file mode 100644 index 000000000..3285a0f56 --- /dev/null +++ b/config/presets/identifiers/suffix-identifiers.json @@ -0,0 +1,19 @@ +{ + "@context": "https://linkedsoftwaredependencies.org/bundles/npm/@solid/community-server/^0.0.0/components/context.jsonld", + "@graph": [ + { + "@id": "urn:solid-server:default:IdentifierStrategy", + "@type": "SingleRootIdentifierStrategy", + "SingleRootIdentifierStrategy:_baseUrl": { + "@id": "urn:solid-server:default:variable:baseUrl" + } + }, + { + "@id": "urn:solid-server:default:IdentifierGenerator", + "@type": "SuffixIdentifierGenerator", + "SuffixIdentifierGenerator:_base": { + "@id": "urn:solid-server:default:variable:baseUrl" + } + } + ] +} diff --git a/config/presets/pod-management.json b/config/presets/pod-management.json index 9ce746377..6d54c68b9 100644 --- a/config/presets/pod-management.json +++ b/config/presets/pod-management.json @@ -21,10 +21,7 @@ "@id": "urn:solid-server:default:ResourceStore" }, "GeneratedPodManager:_idGenerator": { - "@type": "SuffixIdentifierGenerator", - "SuffixIdentifierGenerator:_base": { - "@id": "urn:solid-server:default:variable:baseUrl" - } + "@id": "urn:solid-server:default:IdentifierGenerator" }, "GeneratedPodManager:_resourcesGenerator": { "@id": "urn:solid-server:default:ResourcesGenerator" diff --git a/config/presets/storage-wrapper.json b/config/presets/storage-wrapper.json index 58177e9a2..95fd8ce45 100644 --- a/config/presets/storage-wrapper.json +++ b/config/presets/storage-wrapper.json @@ -9,14 +9,6 @@ } }, - { - "@id": "urn:solid-server:default:IdentifierStrategy", - "@type": "SingleRootIdentifierStrategy", - "SingleRootIdentifierStrategy:_baseUrl": { - "@id": "urn:solid-server:default:variable:baseUrl" - } - }, - { "@id": "urn:solid-server:default:AuxiliaryStrategy", "@type": "RoutingAuxiliaryStrategy", diff --git a/config/presets/storage/backend/storage-filesystem-subdomains.json b/config/presets/storage/backend/storage-filesystem-subdomains.json new file mode 100644 index 000000000..b52bd837c --- /dev/null +++ b/config/presets/storage/backend/storage-filesystem-subdomains.json @@ -0,0 +1,38 @@ +{ + "@context": "https://linkedsoftwaredependencies.org/bundles/npm/@solid/community-server/^0.0.0/components/context.jsonld", + "@graph": [ + { + "@id": "urn:solid-server:default:FileIdentifierMapper", + "@type": "SubdomainExtensionBasedMapper", + "SubdomainExtensionBasedMapper:_base": { + "@id": "urn:solid-server:default:variable:baseUrl" + }, + "SubdomainExtensionBasedMapper:_rootFilepath": { + "@id": "urn:solid-server:default:variable:rootFilePath" + }, + "SubdomainExtensionBasedMapper:_baseSubdomain": "www", + "SubdomainExtensionBasedMapper:_overrideTypes_acl": "text/turtle", + "SubdomainExtensionBasedMapper:_overrideTypes_meta": "text/turtle" + }, + { + "@id": "urn:solid-server:default:FileDataAccessor", + "@type": "FileDataAccessor", + "FileDataAccessor:_resourceMapper": { + "@id": "urn:solid-server:default:FileIdentifierMapper" + } + }, + { + "@id": "urn:solid-server:default:FileResourceStore", + "@type": "DataAccessorBasedStore", + "DataAccessorBasedStore:_accessor": { + "@id": "urn:solid-server:default:FileDataAccessor" + }, + "DataAccessorBasedStore:_identifierStrategy": { + "@id": "urn:solid-server:default:IdentifierStrategy" + }, + "DataAccessorBasedStore:_auxiliaryStrategy": { + "@id": "urn:solid-server:default:AuxiliaryStrategy" + } + } + ] +} diff --git a/test/integration/config/ldp-with-auth.json b/test/integration/config/ldp-with-auth.json index f2eaf13cd..2dde07bf0 100644 --- a/test/integration/config/ldp-with-auth.json +++ b/test/integration/config/ldp-with-auth.json @@ -2,6 +2,7 @@ "@context": "https://linkedsoftwaredependencies.org/bundles/npm/@solid/community-server/^0.0.0/components/context.jsonld", "import": [ "files-scs:config/presets/acl.json", + "files-scs:config/presets/identifiers/suffix-identifiers.json", "files-scs:config/presets/init.json", "files-scs:config/presets/ldp.json", "files-scs:config/presets/ldp/credentials-extractor.json", diff --git a/test/integration/config/server-memory.json b/test/integration/config/server-memory.json index a55ade275..716985dd7 100644 --- a/test/integration/config/server-memory.json +++ b/test/integration/config/server-memory.json @@ -3,6 +3,7 @@ "import": [ "files-scs:config/presets/acl.json", "files-scs:config/presets/http.json", + "files-scs:config/presets/identifiers/suffix-identifiers.json", "files-scs:config/presets/init.json", "files-scs:config/presets/ldp.json", "files-scs:config/presets/ldp/credentials-extractor.json", diff --git a/test/integration/config/server-without-auth.json b/test/integration/config/server-without-auth.json index 1f09e5e41..abcffb8a5 100644 --- a/test/integration/config/server-without-auth.json +++ b/test/integration/config/server-without-auth.json @@ -3,6 +3,7 @@ "import": [ "files-scs:config/presets/acl.json", "files-scs:config/presets/http.json", + "files-scs:config/presets/identifiers/suffix-identifiers.json", "files-scs:config/presets/ldp/credentials-extractor.json", "files-scs:config/presets/ldp/metadata-handler.json", "files-scs:config/presets/ldp/operation-handler.json",