mia-platform / mia-platform/custom-plugin-lib
Microservice gateway env variable is required, but it could not be deployed
- Dominant language
- JavaScript
- Stars
- 25
- Forks
- 7
- PR merge metrics
- No merged PRs in 30d
Description
## Description
[Here](https://github.com/mia-platform/custom-plugin-lib/blob/2dbeca7f1d0e5e67c28beb04635ffd74de5b812f/index.js#L54) the MICROSERVICE_GATEWAY_SERVICE_NAME env variable is set as required, but the service could not exist.
The presence of this variable could bring to use the `getServiceProxy` function, which url is set to the microservice-gateway (which is unreachable).
An example usecase is a project which initially contains the microservice-gateway, and at a later time it will be removed. If a service called to the microservice-gateway, it throws with some error.
## Proposed feature
My proposal is to set the `MICROSERVICE_GATEWAY_SERVICE_NAME` env variable as not required.
If it is set (and it is not empty), the `getServiceProxy` remains as today (so the `microservice-gateway` service is called).
If, on the other hand, the env variable is not set (or is empty) and the service calls the `getServiceProxy` method, the service will throw a clear error. In this way, it is possible to catch the issue with the explaination on how to fix it.
If possible, it would be great if throwed error could be raised on service startup.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with index.js at line 54 and trace the getServiceProxy implementation to understand how MICROSERVICE_GATEWAY_SERVICE_NAME is validated and used. Define the behavior for a missing or empty variable, including whether the error occurs during startup or when getServiceProxy is called. Done means the variable is optional, configured services retain current behavior, and missing configuration produces a clear error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100