Comments (7)
The final decision is to put it into swagger-codegen to inject security for server info and an endpoint to specification in the preprocessing phase. It works pretty well and this can be a common ways to add other common endpoints in the feature. The server info handler is renamed so that it can match the same name generated. The import statement is change the template to point the handler to the one in light-java instead.
from light-4j.
Yes, if project generated by swagger we can't add other handlerProviders like info/healthy ...
Even if add new handlerProvider to com.networknt.server.HandlerProvider
But it is so need!
from light-4j.
Two months ago, I have tried to inject the a separate path with /server/info and a specific scope to control who can access it in SwaggerHandler. It is working but I just don't feel good about it. One problem with this is the final url is dynamic as the API/service swagger spec might have v1 or v2 as base path and it is not predictable. We need a static server info url so that it can be called from portal. I am working on the service registry and discovery now and hoping to let the server to send notification to portal once it is up and running with full path of server info url just like it register itself with Consul or Zookeeper. The other way to work our is inject a handler into the call chain to bypass swagger, validation etc. It is doable but pretty messy as call chain is dynamic per API/service. I am open to any ideas or recommendations at the moment and will come back to this issue soon as this is needed for production like you said.
from light-4j.
In this cause i really don't know how better it do...
I can offer this way: add PATH an exception for swagger-validation which get from config.
HandlerProvider is manually added routing (for example /server/info).
from light-4j.
This is the approach I was taking but due to the dependency of base path in the original swagger spec, the server/info might have /v1 or /v2 or some other prefixes. Also, you don't need to by pass the validation and security as when you inject something the scope and other validation constraints will be in. I am hoping I will have answers once service registry is completed and see if we can let server to register the server/info endpoint on consul or zookeeper.
from light-4j.
Tried to convert ServerInfoHandler to middleware so that it can be put into the middleware chain. It works but it doesn't make sense that every request must go through ServerInfoHandler to check it the uri is matched. It is too much overhead just for this simple common API.
from light-4j.
The next step is to secure the endpoint so that only light-portal can access it.
from light-4j.
Related Issues (20)
- update mras, salesforce and external service config to support JSON string
- Update GenericDataSource to handle integer environment variable
- update ContentType to add application/yaml
- update DefaultConfigLoader to support YAML response from config-server
- change the content type to application/x-yaml for yaml
- rollback 2149 to change back to application/yaml HOT 1
- return 415 error if config server not return yaml and json format
- we need to load both decryped yaml and undecryped yaml from config server
- stop server or use the backup to start the server on config server error
- HandlerConfig supports additionalHandlers, additionalChains and additionalPaths
- remove jaeger-tracer module as it is replaced by OpenTelemetry
- split handler-config from handler module
- refactor limit-config to remove dependency for undertow
- remove the token from portal-registry.yml
- resolve the config reload registry issue
- Fix cases where Connection Establishment Timed Out is incorrectly logged (1.6.x) (SimplePool)
- remove unused imports
- Add aws lambda error codes
- DefaultConfigLoader handles lightEnv in one place in the beginning
- fallback to cached config to start server for ConnectExecption and HttpConectTimeoutException
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from light-4j.