Expressions and Context

When writing architect.yml files, you can reference information about the runtime or environment, details that are otherwise unique to each deployed environment, through Architect's expression syntax. Encoding component's with these references can help limit the manual configuration needs of your services and make them portable from environment to environment.

Available contexts

There are several context groups that contain important, dynamic information about your component and its future deployed environment. Below are the context categories available for reference:

Context nameDescription
environmentInformation about the environment the component was (or will be) deployed to
parametersDynamic values for the parameters declared by your component
servicesReferences to the dynamic outputs of each service and their interfaces
dependenciesReferences to the dynamic outputs of each dependency and their interfaces

environment context

The environment context contains information about the deployed environment itself.

PropertyTypeDescription
environmentobject
environment.ingressesobjectInformation on the ingress rules of the environments
environment.ingresses.<component>objectInformation on an ingress rule matching the specified component
environment.ingresses.<component>.<interface>objectInformation on an ingress rule matching the specified component and interface. See the interface context for more details.

parameters context

The parameters context contains all the values assigned to each parameter declared by your component.

PropertyTypeDescription
parametersobjectA dictionary containing the parameter values
parameters.<key>stringResolves to the value of the specified parameter

services context

The services context contains dynamic information about all the services inside the component. This context can primarily be used to refer to the interfaces of other services inside the component.

PropertyTypeDescription
servicesobjectInformation about each service inside the component
services.<service>objectInformation specific to one of the named services inside the component
services.<service>.interfacesobjectInformation about the specified service's interfaces
services.<service>.interfaces.<interface>objectInformation about the specified service interface. See the interface context for more details.

dependencies context

The dependencies context contains dynamic information about the dependencies of the component. This context can primarily be used to refer to the internal addresses of dependency interfaces.

PropertyTypeDescription
dependenciesobjectInformation about the component's dependencies
dependencies.<dependency>objectInformation about the specified dependency
dependencies.<dependency>.interfacesobjectInformation about the dependency's interfaces
dependencies.<dependency>.interfaces.<interface>objectInformation about the specified interface of the dependency. See the interface context for more details.

The interface context

The interface context is one referenced in many places, services, environment, dependencies, and more, with a set of uniform values available to reference. These values include:

PropertyTypeDescription
urlstringThe fully resolvable URL of the interface (e.g. <protocol>://<username>:<password>@<host>:<port>)
protocolstringThe protocol component of the interface
hoststringThe host component of the interface
portstringThe port component of the interface
usernamestringThe username component of the interface. This will be empty if there is no username for the interface.
passwordstringThe password component of the interface. This will be empty if there is no password for the interface.
    Available contexts
      environment context
      parameters context
      services context
      dependencies context
      The interface context