swindon-rs / swindon

An HTTP edge (frontend) server with smart websockets support
Apache License 2.0
101 stars 9 forks source link

Dynamic routing take 1 #12

Open tailhook opened 7 years ago

tailhook commented 7 years ago

As the step one we just fetch addresses from external source:

http-destinations:
  my-application:
    addresses: !JsonRequest verwalter/v1/schedule?key=data.roles.my-application.all_backends
  verwalter:
    addresses:
    - localhost:8379

More comprehensive settings might look like:

htttp-destinations:
  my-application:
    addresses: !JsonRequest
      destination: verwalter/v1/schedule
      query-string: "key=data.roles.my-application.all_backends"
      refresh-interval: 10 seconds

Technically, as we support changing addresses on the fly anyway this should be relatively easy to implement.

/cc @popravich

popravich commented 7 years ago

Probably destintation: verwalter/.... would look more consistent than url:.

tailhook commented 7 years ago

Updated

tailhook commented 7 years ago

Well, after some thinking, I don't want any special tags on addresses:, I think we should implement configurable name service, with some .verwalter suffix resolved via verwalter's API.

Keeping this issue open, until issue on name resolution is created.