Skip to main content
Config
- Vertex Config
- Vertex config has a lot of functionality and supports a lot of different formats.
- Jason, properties, YAML(Extension),Hocon(extension).
- Configuration properties can be stored in multiple stores
- System properties
- Environment properties
- Files
- Event bus
- Kubernetes Config Map(extension)
- An environment store can be configured as follows
- By creating a new config store object and setting the correct type.
- The store also accepts some configuration properties.
- The configuration is a vertex Jason object, and here we can put in properties for the environment store.
- The environment variables can be filtered, so not all environment variables from the system will be exposed to the application. Only the keys which are defined in the config will be exposed.
- The configuration is overloaded if the same property is defined in the property store added next.
- We should be careful of how the stores are added To the configuration server.
- Basically we should first add environment property store and then overload with system property store.
- In this case, the properties are first picked from the environment variables and are than overloaded if they are defined in the system properties as well.
- The store added later will override the store added First
- YAML store
- The YAML store Is of type file and specifies the format YAML as configuration.
- The path of YAML file is provided in configuration.
- Overloading rules
- Vertex config add the ability to add multiple stores, so there are some overloading rules in place.
- This means that when adding multiple stores and using the same configuration property with same name, the configuration may be overridden.
- To ensure that the configuration is not overridden Use unique names or make sure to add the stores in the correct order.
- A store added after another store in config retriever options may override Properties of a previous store.
- By changing the order of adding the stores, the priorities can be changed.
- We use config module to get data from environment variables.
- We use dependency vertex–config.
- The environment variables are not available during test runtime.
- To avoid this issue, we also enable configuration via system properties.
- We set the property on startup under Function annotated by @BeforeEach.
Comments
Post a Comment