-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Default config (and plugins) #262
Comments
Current workaround with yaml anchors: httplug:
plugins:
cache:
# Should be the auto-wired service.
# @see https://github.com/php-http/HttplugBundle/issues/263
cache_pool: 'cache.app'
clients:
default: &default
factory: 'httplug.factory.guzzle6'
config: &default_config
timeout: 15
http_methods_client: true
plugins:
- 'httplug.plugin.cache'
default_v6:
<<: *default
config:
<<: *default_config
force_ip_resolve: v6
profiling:
captured_body_length: 1000 But it's not very pretty and works only with YAML. |
That is some cool yaml. I've never seen that. I agree with the "default" section. Look how Symfony Messenger does it. They had "middlewares_before" and "middlewares_after". That might make sense here as well. |
agreed, i like the proposal and @Nyholm input. lets have plugins_before and plugins_after. that was the first question i asked myself looking at the example: how do we control the order, as order can matter with the plugins. do you want to work on this @soullivaneuh ? |
@Nyholm This is Yaml anchors. It is mentioned on the spec: https://yaml.org/spec/1.2.2/#3222-anchors-and-aliases And you can find several samples on the web, for example: https://support.atlassian.com/bitbucket-cloud/docs/yaml-anchors/ It is cool but can be quickly very verbose and has some limitations, especially for array values management: https://stackoverflow.com/q/4948933
I agree with that.
I may, but I don't know when. As the need is strictly related to the company where I work and the workaround looks enough so far, it is not yet planned. I suggest to keep the issue open, feel free to any-one taking care of it! 👍 |
Actual Behavior
On each client we configure, we have to define the plugins we want. In case of plugin we want everywhere, we have to repeat the configuration on each of them.
Expected Behavior
The idea is to allow a common client configuration to be applied on each defined client.
With that, we will be able to define common plugin setup with ease. We can also think about it for other option like
http_methods_client
.Sample:
What do you think?
The text was updated successfully, but these errors were encountered: