Skip to content

Commit a0b386d

Browse files
committed
Added default git auth config entry
1 parent 373a12f commit a0b386d

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

internal/server/repo_cache.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ package server
66
import (
77
"fmt"
88
"os"
9+
"strings"
910

1011
"github.com/go-git/go-git/v5"
1112
"github.com/go-git/go-git/v5/plumbing"
@@ -66,6 +67,10 @@ func (r *RepoCache) CheckoutRepo(sourceUrl, branch, commit, gitAuth string) (str
6667
cloneOptions.Depth = 1
6768
}
6869

70+
if gitAuth == "" && strings.HasPrefix(repo, "git@github.com:") {
71+
gitAuth = r.server.config.Security.DefaultGitAuth
72+
}
73+
6974
if gitAuth != "" {
7075
// Auth is specified, load the key
7176
authEntry, err := r.server.loadGitKey(gitAuth)

internal/system/clace.default.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ session_block_key = "" # the block key for session cookie. Auto genera
3434
session_max_age = 86400 # session max age in seconds
3535
session_https_only = true # session cookie is HTTPS only
3636
app_default_auth_type = "system" # default auth type for apps, "system" or "none" or custom auth
37+
default_git_auth = "" # default git auth entry to use
3738

3839
# Logging related Config
3940
[logging]

internal/types/types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ type SecurityConfig struct {
177177
SessionMaxAge int `toml:"session_max_age"`
178178
SessionHttpsOnly bool `toml:"session_https_only"`
179179
CallbackUrl string `toml:"callback_url"`
180+
DefaultGitAuth string `toml:"default_git_auth"`
180181
}
181182

182183
// MetadataConfig is the configuration for the Metadata persistence layer

0 commit comments

Comments
 (0)