Move Docker/Podman endpoint to application.properties

Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
This commit is contained in:
Georg Pfuetzenreuter 2022-05-12 13:14:41 +02:00
parent ddce359812
commit e724d7fd9e
Signed by: Georg
GPG Key ID: 1ED2F138E7E6FF57
4 changed files with 36 additions and 8 deletions

View File

@ -8,6 +8,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import com.github.dockerjava.api.DockerClient;
import com.github.dockerjava.api.command.BuildImageResultCallback;
import com.github.dockerjava.api.command.CreateContainerResponse;
@ -24,8 +25,7 @@ import com.github.dockerjava.transport.DockerHttpClient;
public class Docker {
static DockerClientConfig DockerConfig = DefaultDockerClientConfig.createDefaultConfigBuilder()
.withDockerHost("tcp://sweetsuse:2375")
//.withDockerHost("tcp://sweetsuse:8085")
.withDockerHost(DockerProperties.getEndpoint())
.withDockerTlsVerify(false)
.build();

View File

@ -0,0 +1,20 @@
package net.libertacasa.pubsh.web;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
@Component
@ConfigurationProperties("lysergic.docker")
public class DockerProperties {
private static String endpoint;
public void setEndpoint(String endpoint) {
DockerProperties.endpoint = endpoint;
}
public static String getEndpoint() {
return endpoint;
}
}

View File

@ -1,5 +1,12 @@
{"properties": [{
"name": "spring.datasource.jdbc-url",
"type": "java.lang.String",
"description": "New Hikari JDBC connection URI specifier"
}]}
{"properties": [
{
"name": "spring.datasource.jdbc-url",
"type": "java.lang.String",
"description": "New Hikari JDBC connection URI specifier"
},
{
"name": "lysergic.docker.endpoint",
"type": "java.lang.String",
"description": "Custom variable to specify Docker/Podman API endpoint"
}
]}

View File

@ -10,4 +10,5 @@ spring.datasource.driverClassName=org.mariadb.jdbc.Driver
spring.datasource.jdbc-url=jdbc:mariadb://${DB_HOST}/${DB}
spring.datasource.username=${DB_USER}
spring.datasource.password=${DB_SECRET}
db-scheduler.enabled=true
db-scheduler.enabled=true
lysergic.docker.endpoint=${CONTAINER_API}