mirror of
https://gitea.com/gitea/runner.git
synced 2026-11-08 08:10:30 +00:00
chore(runner): remove client secret and add UUID in runner
Signed-off-by: Bo-Yi.Wu <[email protected]>
This commit is contained in:
1 parent
bf5e3dc302
commit
e08495af09
9 files changed
+122
-167
No files matched your search
@@ -1,8 +1,11 @@
|
||||
package client
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"gitea.com/gitea/act_runner/core"
|
||||
|
||||
"github.com/bufbuild/connect-go"
|
||||
)
|
||||
|
||||
@@ -56,3 +59,21 @@ func WithGRPCWeb(c bool) Option {
|
||||
cfg.opts = append(cfg.opts, connect.WithGRPCWeb())
|
||||
})
|
||||
}
|
||||
|
||||
// WithUUIDHeader add runner uuid in header
|
||||
func WithUUIDHeader(uuid string) Option {
|
||||
return OptionFunc(func(cfg *config) {
|
||||
if uuid == "" {
|
||||
return
|
||||
}
|
||||
cfg.opts = append(
|
||||
cfg.opts,
|
||||
connect.WithInterceptors(connect.UnaryInterceptorFunc(func(next connect.UnaryFunc) connect.UnaryFunc {
|
||||
return func(ctx context.Context, req connect.AnyRequest) (connect.AnyResponse, error) {
|
||||
req.Header().Set(core.UUIDHeader, uuid)
|
||||
return next(ctx, req)
|
||||
}
|
||||
})),
|
||||
)
|
||||
})
|
||||
}
|
||||
Reference in new issue
Block a user