aboutsummaryrefslogtreecommitdiffstats
path: root/sources/hv-collector-configuration
diff options
context:
space:
mode:
authorFilip Krzywka <filip.krzywka@nokia.com>2019-06-25 11:32:36 +0200
committerFilip Krzywka <filip.krzywka@nokia.com>2019-06-26 08:57:37 +0200
commit006be7f70368ce91986037ae7a032ba00836c6c2 (patch)
treef24bd7eeca2e8245dd30fda05c433debb67068bb /sources/hv-collector-configuration
parent7808010c1a18531ee9b618f934d31816193cac38 (diff)
Add environment configuration to kafka consumer
- HV-VES-specific environment prefix moved inside HvVes modules to allow simpler no-prefix API for other modules - created OptionDSL for brevity Change-Id: I2fabbda1280cc0f913f8a0a04b4a055f39ed1fae Issue-ID: DCAEGEN2-1626 Signed-off-by: Filip Krzywka <filip.krzywka@nokia.com>
Diffstat (limited to 'sources/hv-collector-configuration')
-rw-r--r--sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/impl/HvVesCommandLineParser.kt6
1 files changed, 4 insertions, 2 deletions
diff --git a/sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/impl/HvVesCommandLineParser.kt b/sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/impl/HvVesCommandLineParser.kt
index c6730a4c..27560642 100644
--- a/sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/impl/HvVesCommandLineParser.kt
+++ b/sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/impl/HvVesCommandLineParser.kt
@@ -29,6 +29,7 @@ import org.apache.commons.cli.DefaultParser
import org.apache.commons.cli.Options
import org.onap.dcae.collectors.veshv.commandline.CommandLineOption.CONFIGURATION_FILE
import org.onap.dcae.collectors.veshv.commandline.CommandLineOption.HEALTH_CHECK_API_PORT
+import org.onap.dcae.collectors.veshv.commandline.EnvPrefix
import org.onap.dcae.collectors.veshv.commandline.WrongArgumentError
import org.onap.dcae.collectors.veshv.commandline.intValue
import org.onap.dcae.collectors.veshv.commandline.stringValue
@@ -42,7 +43,7 @@ internal class HvVesCommandLineParser(private val parser: CommandLineParser = De
fun getConfigurationFile(args: Array<out String>): Either<WrongArgumentError, File> =
parse(args) {
- it.stringValue(CONFIGURATION_FILE).map(::File)
+ it.stringValue(CONFIGURATION_FILE, HV_VES_ENV_PREFIX).map(::File)
}.toEither {
WrongArgumentError(
message = "Base configuration filepath missing on command line",
@@ -51,7 +52,7 @@ internal class HvVesCommandLineParser(private val parser: CommandLineParser = De
fun getHealthcheckPort(args: Array<out String>): Int =
parse(args) {
- it.intValue(HEALTH_CHECK_API_PORT)
+ it.intValue(HEALTH_CHECK_API_PORT, HV_VES_ENV_PREFIX)
}.getOrElse {
logger.info { "Healthcheck port missing on command line, using default: $DEFAULT_HEALTHCHECK_PORT" }
DEFAULT_HEALTHCHECK_PORT
@@ -76,6 +77,7 @@ internal class HvVesCommandLineParser(private val parser: CommandLineParser = De
.let { parser.parse(it, args) }
companion object {
+ private val HV_VES_ENV_PREFIX = EnvPrefix("VESHV")
private const val DEFAULT_HEALTHCHECK_PORT: Int = 6060
private val logger = Logger(HvVesCommandLineParser::class)
}