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

Move route conditions into a new filter dict #15

Open
ajxchapman opened this issue Mar 6, 2021 · 0 comments
Open

Move route conditions into a new filter dict #15

ajxchapman opened this issue Mar 6, 2021 · 0 comments

Comments

@ajxchapman
Copy link
Owner

The current route definition syntax mixes how route filters are applied, in an HTTP route the method filter is read from the root of the definition:

{
    "protocol" : "http",
    "method" : "HEAD",
    "route" : "^/(.*)",
    "action" : {}
}

Where as in a DNS route, the filters are read in the action object, e.g. the record key below:

{
    "protocol" : "dns",
    "route" : "simple\\.cname\\.{{default_domain}}",
    "action" : {
      "record" : "CNAME",
      "response" : "www.{{default_domain}}"
    }
}

I propose that these filters are moved into a new key filter, which will allow for much more robust filtering. The examples above would become:

{
    "protocol" : "http",
    "route" : "^/(.*)",
    "filter" : {
        "method" : "HEAD"
    },
    "action" : {}
}
{
    "protocol" : "dns",
    "route" : "simple\\.cname\\.{{default_domain}}",
    "filter" : {
        "record" : "CNAME"
    },
    "action" : {
      "response" : "www.{{default_domain}}"
    }
}

An implementation detail of the DNS route would be that the record type would either have to be duplicated in the filter and in the action, or derived from the filter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant