Diff
1diff --git a/internal/config/config.go b/internal/config/config.go
2index c43e0a424d78eba2fdee060b062aa1d61fd6eb74..a0fc5e2231f99c34b35a46eb1724c107bd66bc79 100644
3--- a/internal/config/config.go
4+++ b/internal/config/config.go
5@@ -5,6 +5,7 @@ import (
6 "path/filepath"
7 "strings"
8
9+ "golang.org/x/crypto/ssh"
10 "gopkg.in/yaml.v2"
11
12 "fmt"
13@@ -53,6 +54,16 @@ func NewConfig(cfg *config.Config) (*Config, error) {
14 host := cfg.Host
15 port := cfg.Port
16 pk := cfg.InitialAdminKey
17+
18+ if bts, err := os.ReadFile(pk); err == nil {
19+ // pk is a file, set its contents as pk
20+ pk = string(bts)
21+ }
22+ // it is a valid ssh key, nothing to do
23+ if _, _, _, _, err := ssh.ParseAuthorizedKey([]byte(pk)); err != nil {
24+ return nil, fmt.Errorf("invalid initial admin key: %w", err)
25+ }
26+
27 rs := git.NewRepoSource(cfg.RepoPath)
28 c := &Config{
29 Cfg: cfg,