# Declarative Config: common plugin configuration

**URL:** <https://discuss.konghq.com/t/declarative-config-common-plugin-configuration/3899>\
**Category:** General\
**Created:** [July 3, 2019, 8:53am UTC](https://discuss.konghq.com/t/declarative-config-common-plugin-configuration/3899 "2019-07-03T08:53:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ceyhun\_Ozgun](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/ceyhun_ozgun/32/1148_2.png) [@Ceyhun\_Ozgun](https://discuss.konghq.com/u/Ceyhun_Ozgun)\
**Post date:** [July 3, 2019, 8:53am UTC](https://discuss.konghq.com/t/declarative-config-common-plugin-configuration/3899/1 "2019-07-03T08:53:01Z")

</div>

Hi,  
I want to enable my custom auth plugin for about 20 services but there are services also (for example: dummy service in the configuration below) that I don’t want to attach with that plugin.

My custom plugin requires some config parameters as shown below.  
In declarative config, I have to define 20 plugins for each service because each plugin definition can only be attached to one service only via service attribute  
This means repeating the same plugin configuration parameters for each plugin definition which I found it is not manageable.

The solution I use is YAML anchors and references but the downside is I can’t define anchor on the root level. I have to define it in the first plugin definition and reference it on the next definitions.

Is there any better way?

Thanks in advance

\_format\_version: “1.1”

plugins:

- name: custom-auth  
service: alerts-service  
config: &CONFIG  
auth\_sidecar\_host: “127.0.0.1”  
auth\_sidecar\_port: 8082  
auth\_sidecar\_timeout: 3000  
auth\_sidecar\_path: “/auth”  
log\_to\_file: true  
log\_file\_path: “…/work/logs/api-gateway-access.log”

- name: custom-auth  
service: users-service  
config: \*CONFIG

- name: custom-auth  
service: teams-service  
config: \*CONFIG

- name: prometheus

services:

- name: alerts-service  
url: https://ALERTS\_SERVICE\_HOST/  
routes:

- name: users-service  
url: https://USERS\_SERVICE\_HOST/  
routes:

- name: teams-service  
url: https://TEAMS\_SERVICE\_HOST/  
routes:

- name: dummy-service  
url: [http://localhost:6000/](http://localhost:6000/)  
routes:
