CHE-275: rename DOCKER_MACHINE_HOST to CHE_DOCKER_MACHINE_HOST

Signed-off-by: Alexander Garagatyi <agaragatyi@codenvy.com>
6.19.x
Alexander Garagatyi 2016-02-29 20:06:13 +02:00
parent 4b81105e07
commit 4f1d9708d1
3 changed files with 14 additions and 11 deletions

View File

@ -232,7 +232,7 @@ set_environment_variables () {
fi
if [[ "${CHE_IP}" != "" ]]; then
export DOCKER_MACHINE_HOST="${CHE_IP}"
export CHE_DOCKER_MACHINE_HOST="${CHE_IP}"
fi
#if [ "${WIN}" == "true" ] && [ ! -z "${JAVA_HOME}" ]; then
@ -566,7 +566,7 @@ kill_and_launch_docker_che () {
-v //home/user/che/lib:/home/user/che/lib-copy \
-v //home/user/che/workspaces:/home/user/che/workspaces \
-v //home/user/che/tomcat/temp/local-storage:/home/user/che/tomcat/temp/local-storage \
-e DOCKER_MACHINE_HOST=${DOCKER_PRINT_VALUE} --name ${CONTAINER} -d --net=host codenvy/che:${CHE_DOCKER_TAG} \
-e CHE_DOCKER_MACHINE_HOST=${DOCKER_PRINT_VALUE} --name ${CONTAINER} -d --net=host codenvy/che:${CHE_DOCKER_TAG} \
bash -c "tail -f /dev/null" || DOCKER_EXIT=$? || true
set +x
}

View File

@ -19,27 +19,30 @@ import org.eclipse.che.plugin.docker.machine.DockerInstanceRuntimeInfo;
import javax.inject.Inject;
import javax.inject.Named;
import static com.google.common.base.MoreObjects.firstNonNull;
/**
* Gets predefined docker containers host for machine servers instead of evaluating it from docker configuration
*
* <p>Value of host can be retrieved from property ${code machine.docker.local_node_host} or
* from environment variable {@code DOCKER_MACHINE_HOST}.<br>
* from environment variable {@code CHE_DOCKER_MACHINE_HOST}.<br>
* Environment variable has lower priority.
*
* @author Alexander Garagatyi
* @see org.eclipse.che.plugin.docker.machine.ServerConf
*/
public class LocalDockerInstanceMetadata extends DockerInstanceRuntimeInfo {
public class LocalDockerInstanceRuntimeInfo extends DockerInstanceRuntimeInfo {
/**
* Env variable that shows host (or IP) where docker machines are deployed
*/
public static final String DOCKER_MACHINE_HOST = "DOCKER_MACHINE_HOST";
public static final String CHE_DOCKER_MACHINE_HOST = "CHE_DOCKER_MACHINE_HOST";
@Inject
public LocalDockerInstanceMetadata(@Assisted ContainerInfo containerInfo,
@Assisted String containerHost,
@Nullable @Named("machine.docker.local_node_host") String dockerNodeHost) {
super(containerInfo, dockerNodeHost != null ? dockerNodeHost :
(System.getenv(DOCKER_MACHINE_HOST) != null ? System.getenv(DOCKER_MACHINE_HOST) : containerHost));
public LocalDockerInstanceRuntimeInfo(@Assisted ContainerInfo containerInfo,
@Assisted String containerHost,
@Nullable @Named("machine.docker.local_node_host") String dockerNodeHost) {
super(containerInfo, firstNonNull(firstNonNull(dockerNodeHost,
System.getenv(CHE_DOCKER_MACHINE_HOST)),
containerHost));
}
}

View File

@ -47,7 +47,7 @@ public class LocalDockerModule extends AbstractModule {
.implement(InstanceProcess.class, DockerProcess.class)
.implement(DockerNode.class, LocalDockerNode.class)
.implement(DockerInstanceRuntimeInfo.class,
org.eclipse.che.plugin.docker.machine.local.LocalDockerInstanceMetadata.class)
org.eclipse.che.plugin.docker.machine.local.LocalDockerInstanceRuntimeInfo.class)
.build(org.eclipse.che.plugin.docker.machine.DockerMachineFactory.class));