Closed alexppg closed 3 years ago
This option already exists :smile:
What does defined self.enabled? I only see this: https://github.com/python-microservices/pyms/blob/aefb690659ff9a6529a3249e50ad150e3589f066/pyms/flask/services/driver.py#L51
How can you change its value?
It's magic :stuck_out_tongue:
DriverService
has this method:
When you "call" an attribute, DriverService
searchs in self.config
, and self.config
contains the key-values that you've defined in your config.yaml for this service. Therefore, each key in your config.yaml is an attribute of your Service
I see. So if we add a if self.service.enabled:
in all the init_$service
methods, we would make it a de facto standard, don't we?
Do you agree with doing that?
But each service has an enabled
attribute, that inherits from DriverService
Or sorry if i didn't understand the proposal, what do you mean? Thanks @alexppg :)
Oh, I see. So just to clarify, if I do:
pyms:
services:
requests:
enabled: true
data: ""
swagger:
enabled: false
path: ""
file: "swagger.yaml"
The swagger service won't be loaded?
yes it is :smile: the service won't be loaded :+1:
Nice! Then I'll just close it.
Is your feature request related to a problem? Please describe. It's uncomfortable to know that a service is loaded. You have to assume that if it exists in the configuration, it's loaded, but you can't really be sure. Also, the only way to deactivate it is to delete it from the configuration.
Describe the solution you'd like Add a
enabled
key on every service, that pyms uses to load (or not) the service. I think it's easier to understand and to use any service if you can activate it and deactivated just changing theenabled
key.Change the next configuration:
To:
So the requests service is enabled, but the swagger is not.