Service Configurator
Overview
Service Configurator module allows you to record key/value pairs and group them together into services.
A user can define global key/value pairs which are an equivalent of a module constant. A user can group key/values together into a service. For example, a user defines multiple services to call various REST APIs and each service has the same set of keys: URL, userName, userCredentials with different values. Such grouping simplifies programming of REST API calls; a microservice receives the name of the Service Configurator service as a parameter and reads other information from known keys associated with the service.
Service Configurator allows to override values at user level. For example, the userName and userCredentials may depend on the current user of Mendix application. Service Configurator automatically resolves the values which are overwritten at user level. A value to a key may reference another key.
Service Configurator prevents usage of configuration from one environment in a different environment. That is when you clone your production database to a lower environment, Service Configurator automatically prevents usage of production configuration in the lower environment.
Documentation
Description
Service Configurator module allows you to record key/value pairs and group them together into services.
A user can define global key/value pairs which are an equivalent of a module constant. A user can group key/values together into a service. For example, a user defines multiple services to call various REST APIs and each service has the same set of keys: URL, userName, userCredentials with different values. Such grouping simplifies programming of REST API calls; a microservice receives the name of the Service Configurator service as a parameter and reads other information from known keys associated with the service.
Service Configurator allows to override values at user level. For example, the userName and userCredentials may depend on the current user of Mendix application. Service Configurator automatically resolves the values which are overwritten at user level. A value to a key may reference another key.
Service Configurator prevents usage of configuration from one environment in a different environment. That is when you clone your production database to a lower environment, Service Configurator automatically prevents usage of production configuration in the lower environment.
Typical usage scenario
Scenario 1: Record a value which anybody can access.
Register a key with proper type and optionally associate validation microflow to it. In Global tab populate value to the key. Use microflow ServiceConfigurator.ResolveGlobalKey to obtanin the value of the key.
Scenario 2: Override global value at user level.
Implement Scenario 1. In Personal Key Values tab provide new value for the same key. Navigate to Global tab and click Test service key values button. See that value from the Global tab is overwritten with your personal value.
Scenario 3: Services.
Register keys URL and userName of type text; and userCredentials of type secret. In Services tabl create Service1 and associate the three keys with it with appropriate values. Repeat for a new Service2. Use microflow ServiceConfigurator.ResolveAllKeysForServiceName passing the name of either of the services to see the values to the keys.
Scenario 4: Reference values.
Implement Scenario 3. In Global tab associate a value with key URL. In Services tab, open Service1, open URL key value, change value type to Reference, and select URL referenced key value. Click Test service key values button to see how the keys are now resolved for the service.
Features and limitations
Allows to group key/values into services.
Allows to override key/values at user level.
Does not yet allow to import/export key value from other instances.
Dependencies
- CommunityCommons
- DataWidgets
- Encryption
- MxModelReflection
Installation
Download it from the market place to your application. Add page ServiceConfigurator.ServiceConfiguratorWorkbench to menu; alternatively embed region ServiceConfigurator.ServiceConfiguratorWorkbench_Snippet into a page of your choice.
Configuration
Step 1: Define key.
Navigate to Keys tab and start registering various keys you will need in your application. You can optionally associate a validation microflow with a key definition. A sample validation microflow is ServiceConfigurator.PassthroughValidation.
Step 2: Define Global key values (optional)
Navigate to Global tab and associate keys with values.
Step 3: Define Service keys (optional)
Navigate to Services tab, create services, associate keys with services and assign values to the key. Service key values can reference only Global keys populated in Step 2.
Step 4: User specific key values (optional)
Navigate to Personal Key Values tab and associate personal values to Global keys.
Known bugs
None
Frequently Asked Questions
- Q: When I cloned my production instance to the test instance I lost all configuration. Is it normal?
- A: Yes, configuration is instance specific. Your configuration data is cloned with the database, but it stay inactive. We'll address this issue when we introduct export/import of configurations across instances.