Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
@vidaxl/config-getter-for-microservices
Advanced tools
We needed a way to categorize the configuration values to be able to distinguish between them.
We needed a way to categorize the configuration values to be able to distinguish between them.
See below how we did it.
old configuration:
{
"couchbaseServiceUrl": "http://couchbase-service:3000/v1/couchbase",
"productCatalogServiceUrl": "http://product-catalog-service:3000/v1/product-catalog",
"apmServerUrl": "http://10.51.62.67:8200/"
}
new configuration:
{
"couchbaseServiceUrl": {
"value": "http://couchbase-service:3000/v1/couchbase",
"type": "microservice"
},
"productCatalogServiceUrl": {
"value": "http://product-catalog-service:3000/v1/product-catalog",
"type": "microservice"
},
"apmServerUrl": {
"value": "http://10.51.62.67:8200/",
"type": "amp"
}
}
I think you see how it goes, it was needed so we can parse out information for the status-aggregator-vidaxl-config-bridge (also part of this monorepo). I tried to make it compatible with the original system in the src/.../helper/config.js:
module.exports = function config() {
return {
getConfig: function(field) {
return server.environment[field];
}
};
};
It implemenets the getConfig function, so this library as well, and with the new structure it works compatible. of course value can be any object. Currently the same file mentioned above looks like:
module.exports = require('@vidaxl/config-getter-for-microservices')(server.environment)
It is prepared for better times as the configuration is injectable, and let's hope we willn not always rely on global values, but it works now perfectly.
If you are implementing this library, please make sure that you copy/overwrite the .npmrc file with the one you find in the MICRO-49 branch of the product-catalog-service soon it will be in the master too.
If you are about to update the src/.../helper/config.js of it's kind and implement this library, please make sure that the file does not implements other functions/methods, if so please refactor the code that those functionalities would be the part of another module.
For more details please consult the test.js
FAQs
We needed a way to categorize the configuration values to be able to distinguish between them.
We found that @vidaxl/config-getter-for-microservices demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 11 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.