Skip to content
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

Skip endpoint if the host list is empty #743

Closed
wants to merge 1 commit into from

Conversation

thedae
Copy link
Member

@thedae thedae commented Dec 16, 2024

Fixes krakend/krakend-ce#948

Config initialization fails if there's an endpoint without any backend hosts

Example

Config file

{
  "$schema": "https://www.krakend.io/schema/krakend.json",
  "version": 3,
  "echo_endpoint": true,
  "endpoints": [
    {
      "endpoint": "/some-api",
      "backend": [
        {
          "url_pattern": "/__echo",
          "host": [
            "http://localhost:8080"
          ]
        }
      ]
    },
    {
      "endpoint": "/api-without-backend",
      "backend": [
        {
          "url_pattern": "/__echo",
          "host": []
        }
      ]
    }
  ]
}

Config check

$ krakend check -c ./krakend.json 
Parsing configuration file: /home/dae/work/krakend/configs/ce-issue-948/krakend.json
ERROR parsing the configuration file:	'/home/dae/work/krakend/configs/ce-issue-948/krakend.json': can't register 'GET /api-without-backend' endpoint, it doesn't have any host

exit status 1

Startup

$ krakend run -c ./krakend.json 
ERROR parsing the configuration file: '/home/dae/work/krakend/configs/ce-issue-948/krakend.json': can't register 'GET /api-without-backend' endpoint, it doesn't have any host
exit status 255

@thedae
Copy link
Member Author

thedae commented Dec 16, 2024

Not the proper approach, we're going to rework it

@thedae thedae closed this Dec 16, 2024
@thedae thedae deleted the validate_endpoint_hosts branch December 16, 2024 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

An empty host is not detected by validation
1 participant