-
Notifications
You must be signed in to change notification settings - Fork 44
Refactor config. Issue #75 #78
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
Conversation
|
Se asume que un servicio está activo solo si está declarado? Le ves sentido a que el requisito para activar un servicio sea que tenga la clave pyms:
services:
requests:
enabled: true
data: ""
swagger:
enabled: false
path: ""
file: "swagger.yaml"De esta forma seríá más fácil jugar con las configuraciones y hacer cambios en caliente. En vez de andar comentando muchas líneas, solo cambias un booleano. |
| from pyms.flask.app import Microservice | ||
|
|
||
| ms = Microservice(service="my-ms", path=__file__) | ||
| ms = Microservice(path=__file__) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Como es que ya no hace falta? Por otro lado, el path para que se usa?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Service servía para definir el nombre del bloque de configuración, por defecto era:
pyms:
requests:
data: ""
swagger:
path: ""
file: "swagger.yaml"
ms:
DEBUG: true
Y dependiendo del nombre que le pongas en la configuración funcionaba así Microservice(service="mi-bloque-de-configuracion", path=__file__)
pyms:
requests:
data: ""
swagger:
path: ""
file: "swagger.yaml"
mi-bloque-de-configuracion: # <!--
DEBUG: true
Al estar ahora todo bajo pyms tiene menos sentido que sea configurable el nombre. Mejor la constante "config"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Si, pero cual es la variable que define el nombre del microservicio? Pregunto por que eso se usa para meterle la etiqueta service con su nombre en las métricas (y supongo que se usará en más lados).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Si lo dices por el PR #72
Sería
pyms:
services:
tracer:
component_name: "loquesea"
De la configuración de Flask no hay una variable "oficial" que lo defina: https://flask.palletsprojects.com/en/1.1.x/config/. La que usamos normalmente es la de "app_name" dentro del bloque "pyms.config"
Actualizado @alexppg para que admita enabled, pero por retrocompatibilidad si no se declara la keyword "enabled" se asume que si está activo para no dar lugar a confusión |
|
Nice! |
|
Ya está mergeado, pero FYI lo he probado y todo bien, mola! @avara1986 |
Based on issue #75:
configservicesThese changes correspond to making the PyMS configuration more readable.
the configuration changed from:
to
CONFIGMAP_SERVICE: Configuration block is no longer setted. It will be a constantconfigMicroserviceno need the parameterservice. Changed fromMicroservice(service="my-ms", path=__file__,)toMicroservice(path=__file__,)