Uploaded image for project: 'apiman (API Management)'
  1. apiman (API Management)
  2. APIMAN-1293

Ability to use variable substitution in Vert.X config is unpredictable

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 1.3.x, 1.3.3.Final
    • 1.3.1.Final
    • Gateway
    • None

      Depending on a how the specific section of configuration file is parsed variable substitution may or may not work.

      For some sections (my guess is everything not related to vertx) all configuration values are treated as Strings. Here the substitution works fine, e.g.

      "metrics": {
          "class": "io.apiman.gateway.engine.es.ESMetrics",
          "config": {
            "client": {
              // omitted
              "port": "${es.port}",
            }
          }
        },
      

      However VertX related configuration is "Typed" and thus the substitution doesn't work, e.g.

      "http": {
          "port": "${apiman.verticles.http.count}",
          "count": "auto"
      },
      

      Related java snippet from VertxEngineConfig.java

          public JsonObject getVerticleConfig(String verticleType) {
              return config.getJsonObject(VERTICLES).getJsonObject(verticleType.toLowerCase());
          }
      

      After this, the following error message should not be a surprise

      java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number
      

            msavy_jira Marc Savy (Inactive)
            jcechace@redhat.com Jakub Čecháček
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: