I am trying to create a simple processing code to Symfony configuration.
Here is the final effect I want to do (config pseudocode):
# config/packages/monolog.yml
monolog:
handlers:
debug_log:
type: '%env(LOGS_ROTATE) > 0 ? "rotating_file" : "stream"%'
max_files: '%env(LOGS_ROTATE) ?? null%'
...
The idea is that if LOGS_ROTATE env is set to a positive number,
type should be rotating_file and max_files should be that number,
otherwise type should be stream and max_files should be skipped
Is it possible to do that?
I was considering using env processors, but those cannot take any parameters,
and using hardcoding config values inside such a processor feels bad.
edit:
I also tried to use symfony expression language, but got an error:
There is no handler class defined for handler "@=%env(logs_rotate) > 0 ? rotating_file : stream".
monolog:
handlers:
debug_log:
type: "@=%env(LOGS_ROTATE) > 0 ? rotating_file : stream"