package com.njzscloud.common.sshtunnel;

import org.springframework.boot.autoconfigure.condition.ConditionalOnBooleanProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration(proxyBeanMethods = false)
@ConditionalOnBooleanProperty(prefix = "ssh-tunnel", name = "enable")
@EnableConfigurationProperties({SSHTunnelProperties.class})
public class SSHTunnelAutoConfiguration {

    @Bean(destroyMethod = "close")
    public SSHTunnel sshTunnel(SSHTunnelProperties SSHTunnelProperties) {
        return new SSHTunnel(SSHTunnelProperties);
    }

}
