Service (Application) Configuration
Ecotone Framework customization
Ecotone
allows for customization of the core functionality as well as the modules.
Ecotone Core Configuration
Depending on the provider you choose, you can follow configuration in specific menu
Module Extensions
Module Extensions are configurations for specific module. It's class based configuration. Let's take a look on Dbal module configuration as example:
Create your own class. You can name it whatever you like.
Add attribute to let
Ecotone
know that it should call this method to get the configuration.Name the method whatever you like. You may return
array
of configurations orspecific configuration instance
.Return specific configuration.
Ecotone does not require specific class name or method name.
All what is needed is #[ServiceContext]
attribute.
Environment Specific Configuration
If you want to enable different configuration for specific environment you may use of Environment attribute
.
Above will turn off transactions for test
environment, keeping it however for prod
and dev
.
Configuration Variables
You may access your configuration variables inside ServiceContext
methods.
If you don't pass ConfigurationVariable
attribute, it will be taken from parameter name.
Below example is equal to above.
Service Context is evaluated before container is dumped and cached. Therefore if you will change environment variables after your cache is dumped this won't be changed. This happens because Ecotone tries to maximalize configuration caching, in order to speed up run time execution and do no configuration at that time.
Last updated