Skip to content

Store CDN entry for each library as configurable/alterable "entity" #8

Description

@kreynen

I've read #3, but I'm not sure I understand where this is headed.

There are so many use cases where auto detecting a library and trying to find it in various CDNs in the order you've hard coded in a module isn't going to work.

  • The library is patched/altered
  • The library is found in CDN, but that CDN's performance sucks for your region
  • You want to a use a new CDN that isn't supported

It looks like you already have the auto discovery of libraries and finding them in various CDNs working... which is GREAT! What I've like to see is both the list of CDNs and libraries be stored as a configurable/alterable "entity". Using a full blown node based content type is overkill for this task. Entities are also probably more than you need. Defining a Ctools plugin for this seems like a good fit for the libraries. That would give you forms that users could use to alter the configuration as well Feature exports "out of the box".

Take a look at how this is defined in https://www.drupal.org/project/css_injector or https://www.drupal.org/project/js_injector.

For the supported CDNs, it would be create if these were added via a hook that allowed other modules to extend the list by defining the path, name, and version. Simple weight and status variables for each CDN would allow users to order which CDN is checked first. Each library would need to keep an ordered array of the CDN to use (if any) for that library.

That change would also allow sites to register private CDNs first with several public CDNs as fallbacks.

A final feature related to these changes is the ability to alter the CDN used. The use case for all of this could a university that runs a CDN on their network for on campus requests, but would use an external CDN to improve load times for external requests. I would like to be able to write a helper module for this that checks to see if the user is authenticated and the IP maing the request is on campus. If it is, use our internal CDN. If the user isn't authenticated and/or the request is from off campus, use the external CDN.

Does that make sense?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions