flipt-io / cup

Git Contribution Automation
https://cup.flipt.io
Apache License 2.0
76 stars 1 forks source link

Teach cup to connect to Tailscale #50

Closed brettbuddin closed 1 year ago

brettbuddin commented 1 year ago

Usage:

; cup --tailscale-hostname=coffee

I was interested in standing cup up within my Tailscale network so I added tsnet.

When the --tailscale-hostname is set, it will attempt to connect the service to Tailscale at that hostname. You'll need to either supply a token or visit the URL in the logs to authenticate the service within the tailnet.

The HTTP server is wrapped in a middleware that extracts identity information from all requests and supplies it to later stages via the request's context.Context. The identity can be extracted using the helper function: tailscale.WhoIs(ctx).

GeorgeMac commented 1 year ago

You legend, you @brettbuddin

On the logging thing, the API is completely incongruent in cup with the rest of the logging. I think I need to teach chi to talk slog really.

brettbuddin commented 1 year ago

@GeorgeMac I'll go ahead and try and make a middleware that conforms to that. At least then log.Printf and slog will be used together and it'll look somewhat the same.

brettbuddin commented 1 year ago

I'll swap out exp/slices and friends with their first-class cousins while I'm in here.