Skip to content

ConfigRetriever uses data type double for Integer env values #110

Description

@MarWestermann

Version

3.7.1

Context

An Environment variable like PORT=8080 is converted to 8080.0 (double) in config json.

Do you have a reproducer?

Add Environment Variable PORT = 8080 to your system.

val configRetriever = ConfigRetriever.create(vertx)
configRetriever.rxGetConfig().flatMap { configJson ->
 configJson.getInteger("PORT") // Exception: double cannot be casted to Integer
}

Extra

The cause of the issue is in class io.vertx.config.spi.utils.JsonObjectHelper. There in convert method a number value would always be converted to a double but a check is missing if it is a pure Integer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions