Uploaded image for project: 'DMR'
  1. DMR
  2. DMR-45

Resolve env variables without requiring a env. prefix

    XMLWordPrintable

Details

    • Feature Request
    • Resolution: Done
    • Major
    • 1.6.0.Final, 1.6.1.Final
    • None
    • None

    Description

      Currently DMR can resolve expressions by looking at environment variables:

      • if the value is not found in system properties and if the value starts with "env."

      This makes it impossible to have an expression being resolved from either a sys prop or an env var (unless the sys prop name is appended with "env." which is too confusing).

      This RFE proposes to enhance DMR expression resolver by looking for env variables if the system property is not found (without required a "env." prefix).

      The new algorithm in https://github.com/jbossas/jboss-dmr/blob/c17dae88ae1f03c86b8be6c6c4e06fdc23f4b067/src/main/java/org/jboss/dmr/ValueExpressionResolver.java#L191 would be

          protected String resolvePart(String name) {$
              ...
              // First check for system property
              String val = System.getProperty(name);
              // then for env variable without the env. prefix
             if (val == null)
                   val = System.getenv(name);
              // then for env variable with the env. prefix (for backwards compatibility)
              if (val == null && name.startsWith("env."))
                  val = System.getenv(name.substring(4));
      
              return val;
          }
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              jmesnil1@redhat.com Jeff Mesnil
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: