Micronaut’s concept is by default Cloud platform aware and will make a best effort to detect the underlying active environment.
You can then use the Requires annotation to .
The following table summarizes the constants provided by the Environment interface and provides an example:
Note that it may be the case that you have multiple active environment names since you may run Kubernetes on AWS for example.
In addition, using the value of the constants defined in the table above you can create environment specific configuration files. For example if you create a src/main/resources/application-gcp.yml
file then that configuration will only be loaded when running on Google Compute.
Any configuration property in the can also be set via an environment variable. For example, setting the CONSUL_CLIENT_HOST environment variable will override the host property in ConsulConfiguration. |