io.bdeploy.common.cfg.RemoteValidator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of api Show documentation
Show all versions of api Show documentation
Public API including dependencies, ready to be used for integrations and plugins.
package io.bdeploy.common.cfg;
import io.bdeploy.common.cfg.Configuration.ConfigValidator;
import io.bdeploy.common.cfg.Configuration.ValidationMessage;
@ValidationMessage("Invalid remote: '%s'. A remote must be a local path or start with 'https://' and end with '/api'")
public class RemoteValidator implements ConfigValidator {
@Override
public boolean validate(String value) {
String lower = value.toLowerCase();
// Allow local paths and file URLs
if (lower.startsWith("/") || lower.startsWith(".") || lower.startsWith("file:") || lower.startsWith("jar:file:")) {
return true;
}
return lower.startsWith("https://") && lower.endsWith("/api");
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy