-
Notifications
You must be signed in to change notification settings - Fork 162
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
make timings and metadata headers optional #232
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was just thinking the other day that these should be optional! For example the MDN article says
The
Server-Timing
header may expose potentially sensitive application and infrastructure information. Consider to control which metrics are returned when and to whom on the server side. For example, you could only show metrics to authenticated users and nothing to the public.
@kylebarron I've added |
You could just have an |
@kylebarron I'm not sure to fully understand what you mean. are you saying something like 👇 cog = TilerFactory(optional_headers={"timings", ...} |
Yeah basically. You could have an enum of available optional headers. It might also make sense to make the keys the same as the header names, e.g. cog = TilerFactory(optional_headers={"Server-Timing", "X-Assets", ...} (though should be case insensitive) |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Alright @kylebarron,
I don't see how this will be easy to do. basically right now we have I wanted to use I don't really want to spend more time on it but feel free to propose your own PR 🙏 Note:
|
Not every factory needs to implement all the available optional headers... You can have a single enum listing the optional headers available, and just note in the docs (or maybe give a warning at runtime) if a non-mosaic tiler attempts to use the |
seems like more code to me! but also no idea how enum will work for this case when we have multiple values provided as input |
Well the enum part isn't important... All I was suggesting is something like this, instead of making a separate parameter for every optional header like tilerfactory(
...,
optional_headers=['Server-Timing', 'X-Assets']) from . import OptionalHeaders
tilerfactory(
...,
optional_headers=[OptionalHeaders.Server_Timing, OptionalHeaders.X_Assets]) |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Alright it took me some time but I think I understand what you proposed! can you check the last commit and 👍 👎 @kylebarron |
closes #229