Skip to content

Commit 7897bc6

Browse files
committed
Fix bug
1 parent d3be0fb commit 7897bc6

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

modules/setting/ssh.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
package setting
55

66
import (
7+
"os"
78
"path/filepath"
89
"strings"
910
"text/template"
@@ -134,6 +135,11 @@ func loadSSHFrom(rootCfg ConfigProvider) {
134135
}
135136
}
136137

138+
// FIXME: why 0o644 for a directory .....
139+
if err := os.MkdirAll(GetSSHKeyTestPath(), 0o644); err != nil {
140+
log.Fatal("failed to create directory %q for ssh key test: %w", GetSSHKeyTestPath(), err)
141+
}
142+
137143
SSH.KeygenPath = sec.Key("SSH_KEYGEN_PATH").String()
138144
SSH.Port = sec.Key("SSH_PORT").MustInt(22)
139145
SSH.ListenPort = sec.Key("SSH_LISTEN_PORT").MustInt(SSH.Port)

modules/ssh/init.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,6 @@ func Init() error {
3232

3333
builtinUnused()
3434

35-
// FIXME: why 0o644 for a directory .....
36-
if err := os.MkdirAll(setting.GetSSHKeyTestPath(), 0o644); err != nil {
37-
return fmt.Errorf("failed to create directory %q for ssh key test: %w", setting.GetSSHKeyTestPath(), err)
38-
}
39-
4035
if len(setting.SSH.TrustedUserCAKeys) > 0 && setting.SSH.AuthorizedPrincipalsEnabled {
4136
caKeysFileName := setting.SSH.TrustedUserCAKeysFile
4237
caKeysFileDir := filepath.Dir(caKeysFileName)

0 commit comments

Comments
 (0)