11ty/eleventy-fetch

Change or disable "Caching: https://????" message

CosmoMyzrailGorynych opened this issue · 1 comments

The plugin writes out the URL it caches, and some of these URLs contain sensitive data. (API keys lol. Run it on Travis CI and everyone in the world can get them from the public logs.)

It would be cool if the constructor could accept a flag like silent: true or name: 'Secret API request' so you can either completely hide or rename such requests in logs.

Importantly, the removeUrlQueryParams: true option has been present for some time to clean the URL params off of the URL prior to calculating the cache key and the clean URL used in console logs. It does not affect the raw url passed to the underlying fetch call.

https://www.11ty.dev/docs/plugins/cache/#remove-url-query-params-from-cache-identifier

That said, I think there is some additional work we can do here so I’m adding a formatUrlForDisplay(url) callback to the next version that will allow you to transform the URL however you’d like. This does not affect cache key hashing—only logging messages.

I’m also adding a verbose option and changing the default to false to avoid any console logs by default.