package ru.yandex.qe.dispenser.tvm;

import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.env.Environment;
import org.springframework.core.type.AnnotatedTypeMetadata;

public class DeployCondition implements Condition {

    @Override
    public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
        final Environment env = context.getEnvironment();
        return env.containsProperty("TVMTOOL_LOCAL_AUTHTOKEN") && env.containsProperty("DEPLOY_TVM_TOOL_URL");
    }
}
