Don't fail when using 'access-control' in non-hosted context
Hosted Vespa applications may use the 'application' framework in their
unit tests. These applications must be allowed to use 'access-control'
in tests, where the config model is running in non-hosted context.
@@ -45,12 +45,13 @@ public class HttpBuilder extends VespaDomBuilder.DomConfigProducerBuilder<Http>
Element accessControlElem = XML.getChild(filteringElem, "access-control");
if (accessControlElem != null) {
- if (!deployState.isHosted()) {
- throw new IllegalArgumentException("The 'access-control' element in currently only available in hosted Vespa.");
- }
+ if (deployState.isHosted()) {
accessControl = buildAccessControl(deployState, ancestor, accessControlElem);
bindings.addAll(accessControl.getBindings());
filterChains.add(new Chain<>(FilterChains.emptyChainSpec(ACCESS_CONTROL_CHAIN_ID)));
+ } else {
+ deployState.getDeployLogger().log(LogLevel.WARNING, "The 'access-control' element is only supported in hosted Vespa.");
+ }
}
} else {
filterChains = new FilterChainsBuilder().newChainsInstance(ancestor);
