OpenSkyRuntimeConfigBundle icon indicating copy to clipboard operation
OpenSkyRuntimeConfigBundle copied to clipboard

How to handle configuration, not services?

Open Koc opened this issue 13 years ago • 1 comments

Hello!

There is part from configuration

services:
    runtime_parameters.security.firewalls.main.remember_me.domain:
        public: false
        class: stdClass
        factory_service: opensky.runtime_config
        factory_method: get
        arguments:
            - security.firewalls.main.remember_me.domain

security:
    firewalls:
        main:
            pattern: .*
            remember_me:
                # ...
                domain: @runtime_parameters.security.firewalls.main.remember_me.domain

It doesnt works as expected:

        $g = new \Symfony\Component\Security\Http\RememberMe\TokenBasedRememberMeServices(array(0 => $b), 'fe1qwd3', 'main', array('name' => 'remember_me', 'lifetime' => '8640000', 'path' => '/',

// as you see - it just use string but not calling service
'domain' => '@runtime_parameters.security.firewalls.main.remember_me.domain',

'secure' => false, 'httponly' => true, 'always_remember_me' => true, 'remember_me_parameter' => '_remember_me'), $c);

What you can advice for me?

Koc avatar Mar 14 '12 22:03 Koc

There's no one-size-fits-all solution to handle this. Config processing is handled by each bundle, so each bundle will have to be considered separately.

Basically, you have two options:

  1. You can fork the bundle, and alter the configuration processing to allow services as an argument. You can then either just use your fork and/or do a PR against the bundle for everyone to be able to use your changes. There is however the risk that the bundle maintainer doesn't want this functionality, in which you'll have to maintain your own fork indefinitely.
  2. You can use a compiler pass to alter the configuration that's been created by the bundle. This may be somewhat easier to maintain (and doesn't involve loads of forks), but it can break with configuration processing updates in the bundle, so you'll need to be watchful when updating bundles...

magnusnordlander avatar May 04 '12 10:05 magnusnordlander