Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add templates parameter #1510

Closed
bourgeoa opened this issue Nov 23, 2022 · 4 comments
Closed

add templates parameter #1510

bourgeoa opened this issue Nov 23, 2022 · 4 comments

Comments

@bourgeoa
Copy link
Contributor

Feature description

To create pods with a different templates than the default one.
This is basically the case when using mashlib.

Actually the only way to import a templates-folder is by making a cp -r templates-folder/ node_modules/@solid/communitys-server/
This works but is not very friendly and need to be redone each time node_modules are updated or rebuild with npm ci

Adding a parameter would make it much easier.

@joachimvh
Copy link
Member

You can use a small Components.js configuration for this using Components.js new override feature.

Specifically, the pod template folder is defined here:

"comment": "Generates resources based on the templates stored in the template folder.",
"@id": "urn:solid-server:default:ResourcesGenerator",
"@type": "TemplatedResourcesGenerator",
"templateFolder": "@css:templates/pod",

You could create a new Components.js config that overrides that template folder like so:

{
  "@context": "https://linkedsoftwaredependencies.org/bundles/npm/@solid/community-server/^5.0.0/components/context.jsonld",
  "@graph": [
    {
      "@type": "Override",
      "overrideInstance": { "@id": "urn:solid-server:default:ResourcesGenerator" },
      "overrideParameters": {
        "@type": "TemplatedResourcesGenerator",
        "templateFolder": "/my/template/folder"
      }
    }
  ]
}

You could then start the server with npm start -- -c config/file.json my-override-config.json to change it to the new template folder value (or combine that config with yours if you already have a custom one). This will survive rebuilds/reinstalls (but might break on a new major release).

@bourgeoa
Copy link
Contributor Author

Thanks I shall try it.

@bourgeoa
Copy link
Contributor Author

Works perfectly.
I discovered with your example that you can have multiple config-file

@joachimvh
Copy link
Member

Works perfectly. I discovered with your example that you can have multiple config-file

Yes, this is a new feature that was just added in v5.1.0.

Note that this solution can break on a new major version release as config structure might change meaning the solution will have to adapt then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants