JSON Evaluation
JSON evaluation is the process of substituting configuration tokens and transforming JSON nodes for an entire JSON configuration. After JSON evaluation, all configuration tokens and transformations in the configuration are replaced by values.
At startup, IG evaluates the configuration tokens in
config.json
and admin.json
. When routes are deployed,
IG evaluates the configuration tokens in the route.
Configuration tokens are matched with tokens available in the chain of resolvers, and the configuration token is substituted with the value available in the resolver. For information about each of the resolvers mentioned in the following section, refer to Token Resolution.
IG searches for matching tokens in the chain of resolvers, using the following order of precedence:
-
Local resolver:
The route resolver for the route being deployed
-
Intermediate resolver:
All intermediate route resolvers (for example, for parent routes to the route being deployed) up to the bootstrap resolver
-
Bootstrap resolver:
-
Environment variables resolver
-
System properties resolver
-
Token source file resolvers
-
Hardcoded default values
-
The first resolver that matches the token returns the value of the token.
If the token can’t be resolved, IG uses the default value defined with the configuration token. If there is no default value, the token can’t be resolved and an error occurs:
-
If the configuration token is in
config.json
oradmin.json
, IG fails to start up. -
If the configuration token is in a route, the route fails to load.
When configuration tokens are nested inside other configuration tokens, the tokens are evaluated bottom-up, or leaf-first. For example, if the following configuration token takes only the default values, it is resolved as follows:
-
"&{&{protocol.scheme|http}.port|8080}"
-
"&{http.port|8080}"
When
&{protocol.scheme|http}
takes the default valuehttp
. -
"8080"
When
&{http.port|8080}
takes the default value8080
.
If the configuration includes a transformation, IG applies the transformation after the token is substituted. When transformations are nested inside other transformations, the transformations are applied bottom-up, or leaf-first. For more information, refer to Transformations.