mirror of
https://gitea.com/gitea/act_runner.git
synced 2025-06-13 01:57:13 +02:00
Refactor environment variables to configuration and registration (#90)
Close #21. Refactor environment variables to configuration file (config.yaml) and registration file (.runner). The old environment variables are still supported, but warning logs will be printed. Like: ```text $ GITEA_DEBUG=true ./act_runner -c config.yaml daemon INFO[0000] Starting runner daemon WARN[0000] env GITEA_DEBUG has been ignored because config file is used $ GITEA_DEBUG=true ./act_runner daemon INFO[0000] Starting runner daemon WARN[0000] env GITEA_DEBUG will be deprecated, please use config file instead ``` Reviewed-on: https://gitea.com/gitea/act_runner/pulls/90 Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
@ -11,7 +11,6 @@ import (
|
||||
|
||||
"code.gitea.io/actions-proto-go/ping/v1/pingv1connect"
|
||||
"code.gitea.io/actions-proto-go/runner/v1/runnerv1connect"
|
||||
"gitea.com/gitea/act_runner/core"
|
||||
"github.com/bufbuild/connect-go"
|
||||
)
|
||||
|
||||
@ -35,13 +34,13 @@ func New(endpoint string, insecure bool, uuid, token, runnerVersion string, opts
|
||||
opts = append(opts, connect.WithInterceptors(connect.UnaryInterceptorFunc(func(next connect.UnaryFunc) connect.UnaryFunc {
|
||||
return func(ctx context.Context, req connect.AnyRequest) (connect.AnyResponse, error) {
|
||||
if uuid != "" {
|
||||
req.Header().Set(core.UUIDHeader, uuid)
|
||||
req.Header().Set(UUIDHeader, uuid)
|
||||
}
|
||||
if token != "" {
|
||||
req.Header().Set(core.TokenHeader, token)
|
||||
req.Header().Set(TokenHeader, token)
|
||||
}
|
||||
if runnerVersion != "" {
|
||||
req.Header().Set(core.VersionHeader, runnerVersion)
|
||||
req.Header().Set(VersionHeader, runnerVersion)
|
||||
}
|
||||
return next(ctx, req)
|
||||
}
|
||||
|
Reference in New Issue
Block a user