zed.deployer.util.DockerUriUtil Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of zed-deployer Show documentation
Show all versions of zed-deployer Show documentation
A application used as an example on how to set up pushing
its components to the Central Repository.
The newest version!
package zed.deployer.util;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class DockerUriUtil extends AbstractUriUtil {
public static String imageName(String prefix, String uri) {
Pattern pattern = Pattern.compile(Pattern.quote(prefix) + "(.*?)" + "(\\?|$)");
Matcher matcher = pattern.matcher(uri);
if (!matcher.find()) {
throw new IllegalArgumentException(uri + " is not a valid docker deploy URI. Proper URI format is docker:imagerepoprefix/image[:tag] .");
}
return matcher.group(1);
}
public static String[] environmentVariables(String uri) {
String[] splitted = uri.split("\\?");
if (splitted.length == 1) {
return new String[]{};
}
List envs = new ArrayList<>();
Matcher m = optionsWithPrefix("e:", splitted[1]);
while (m.find()) {
envs.add(m.group(1));
}
return envs.toArray(new String[]{});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy