Update comments and logs for shouldBuild

Signed-off-by: Nikolas Skoufis <nskoufis@seek.com.au>
This commit is contained in:
Nikolas Skoufis
2022-03-02 10:09:28 +11:00
parent 4368196fba
commit 63bb0a9644
@@ -218,9 +218,11 @@ export async function createRouter(
responseHandler = createEventStream(res);
}
// techdocs-backend will only try to build documentation for an entity if techdocs.builder is set to 'local'
// If set to 'external', it will assume that an external process (e.g. CI/CD pipeline
// of the repository) is responsible for building and publishing documentation to the storage provider
// By default, techdocs-backend will only try to build documentation for an entity if techdocs.builder is set to
// 'local'. If set to 'external', it will assume that an external process (e.g. CI/CD pipeline
// of the repository) is responsible for building and publishing documentation to the storage provider.
// Altering the implementation of the injected docsBuildStrategy allows for more complex behaviours, based on
// either config or the properties of the entity (e.g. annotations, labels, spec fields etc.).
const shouldBuild = await docsBuildStrategy.shouldBuild({ entity });
if (!shouldBuild) {
// However, if caching is enabled, take the opportunity to check and
@@ -253,7 +255,7 @@ export async function createRouter(
responseHandler.error(
new Error(
"Invalid configuration. 'techdocs.builder' was set to 'local' but no 'preparer' was provided to the router initialization.",
"Invalid configuration. 'docsBuildStrategy.shouldBuild returned 'true', but no 'preparer' was provided to the router initialization.",
),
);
});