From 4cfedee9734c2b4682ba4b79ea7d0caf72a29ac1 Mon Sep 17 00:00:00 2001 From: Oleksandr Loushkin Date: Tue, 7 Feb 2017 00:28:31 +0200 Subject: [PATCH] #13 Add ability to specify consul port Add enabled toggle for route and consul service --- gradle.properties | 2 +- komock-core/mock_example.yml | 1 + .../com/lavi/komock/config/property/consul/ConsulProperties.kt | 2 ++ .../ua/com/lavi/komock/config/property/http/RouteProperties.kt | 1 + .../main/kotlin/ua/com/lavi/komock/registrar/ConsulRegistrar.kt | 2 +- 5 files changed, 6 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index 0d180a0..45cba67 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1 +1 @@ -version=1.1.1 \ No newline at end of file +version=1.1.2 \ No newline at end of file diff --git a/komock-core/mock_example.yml b/komock-core/mock_example.yml index 460282e..b9eb813 100644 --- a/komock-core/mock_example.yml +++ b/komock-core/mock_example.yml @@ -1,6 +1,7 @@ consul: enabled: false consulHost: 127.0.0.1 + consulPort: 8500 services: - serviceId: customer-data-service diff --git a/komock-core/src/main/kotlin/ua/com/lavi/komock/config/property/consul/ConsulProperties.kt b/komock-core/src/main/kotlin/ua/com/lavi/komock/config/property/consul/ConsulProperties.kt index 91cf95a..f931967 100644 --- a/komock-core/src/main/kotlin/ua/com/lavi/komock/config/property/consul/ConsulProperties.kt +++ b/komock-core/src/main/kotlin/ua/com/lavi/komock/config/property/consul/ConsulProperties.kt @@ -9,10 +9,12 @@ import java.util.* class ConsulServerProperties { var enabled: Boolean = false var consulHost = "localhost" + var consulPort = 8500 var services = ArrayList() } class ConsulServiceProperties { + var enabled: Boolean = true var serviceId: String = "defaultConsulService" var serviceName: String = "defaultConsulServiceName" var servicePort: Int = 8080 diff --git a/komock-core/src/main/kotlin/ua/com/lavi/komock/config/property/http/RouteProperties.kt b/komock-core/src/main/kotlin/ua/com/lavi/komock/config/property/http/RouteProperties.kt index 8ccedf8..ba42c06 100644 --- a/komock-core/src/main/kotlin/ua/com/lavi/komock/config/property/http/RouteProperties.kt +++ b/komock-core/src/main/kotlin/ua/com/lavi/komock/config/property/http/RouteProperties.kt @@ -8,6 +8,7 @@ import java.util.* */ class RouteProperties { + var enabled: Boolean = true var httpMethod: String = "" var url: String = "" var contentType: String = "" diff --git a/komock-core/src/main/kotlin/ua/com/lavi/komock/registrar/ConsulRegistrar.kt b/komock-core/src/main/kotlin/ua/com/lavi/komock/registrar/ConsulRegistrar.kt index e54e402..5160a06 100644 --- a/komock-core/src/main/kotlin/ua/com/lavi/komock/registrar/ConsulRegistrar.kt +++ b/komock-core/src/main/kotlin/ua/com/lavi/komock/registrar/ConsulRegistrar.kt @@ -14,7 +14,7 @@ class ConsulRegistrar { private val log = LoggerFactory.getLogger(this.javaClass) fun register(consulServerProperties: ConsulServerProperties) { - val clientRegistrar = ConsulClient(consulServerProperties.consulHost) + val clientRegistrar = ConsulClient(consulServerProperties.consulHost, consulServerProperties.consulPort) log.debug("Found: ${consulServerProperties.services.size} consul services") for (consulService in consulServerProperties.services) { val newService = NewService()