mirror of
https://github.com/router-for-me/CLIProxyAPIPlus.git
synced 2026-04-24 03:20:28 +00:00
Add GitLab Duo auth and executor support
This commit is contained in:
@@ -3,6 +3,7 @@ package auth
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@@ -360,6 +361,13 @@ func (a *GitLabAuthenticator) resolveString(opts *LoginOptions, key, fallback st
|
||||
return value
|
||||
}
|
||||
}
|
||||
for _, envKey := range gitLabEnvKeys(key) {
|
||||
if raw, ok := os.LookupEnv(envKey); ok {
|
||||
if trimmed := strings.TrimSpace(raw); trimmed != "" {
|
||||
return trimmed
|
||||
}
|
||||
}
|
||||
}
|
||||
if strings.TrimSpace(fallback) != "" {
|
||||
return fallback
|
||||
}
|
||||
@@ -460,3 +468,18 @@ func maskGitLabToken(token string) string {
|
||||
}
|
||||
return trimmed[:4] + "..." + trimmed[len(trimmed)-4:]
|
||||
}
|
||||
|
||||
func gitLabEnvKeys(key string) []string {
|
||||
switch strings.TrimSpace(key) {
|
||||
case gitLabBaseURLMetadataKey:
|
||||
return []string{"GITLAB_BASE_URL"}
|
||||
case gitLabOAuthClientIDMetadataKey:
|
||||
return []string{"GITLAB_OAUTH_CLIENT_ID"}
|
||||
case gitLabOAuthClientSecretMetadataKey:
|
||||
return []string{"GITLAB_OAUTH_CLIENT_SECRET"}
|
||||
case gitLabPersonalAccessTokenMetadataKey:
|
||||
return []string{"GITLAB_PERSONAL_ACCESS_TOKEN"}
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user