Services improvements #270
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This issue's goal is to give implementers more control over the access of a service publicly (e.g. webserver) versus in Go code, and provide the necessary building blocks to fix readium/cli#62
Changelog
All services are now hidden by default. This mainly affects implementers creating webservers, but you also shouldn't need to manually remove services just to produce clean manifest output. To restore previous functionality, set the
streamer.Config
'sAddServiceLinks
totrue
Added
Services
to get the names of all services currently in the builderExposeLinks
andHideLinks
function to toggle the exposure of a service via the links that get added to the WebPub manifest, as well as access to the service via its well-known link path. By default, services are privatestreamer.Config
has a new property,AddServiceLinks
. Setting this property is equivalent to calling the aforementionedExposeLinks
function for every serviceChanged
ServiceFactory
now has a requiredpublic
property. This lets a service expose itself via theGet
andLinks
function if set to true. This also means that by default, all services are now "private". That means they will not be added to manifests as links, or callable by said link's path. They are still directly accessible in Go code using e.g.Publication.FindService
, and then directly calling their functions by casting them to the correct service type (see e.g.Publication.Positions
)