MCPcopy Create free account
hub / github.com/belak/gitdir / NewServer

Function NewServer

ssh_server.go:32–50  ·  view source on GitHub ↗

NewServer configures a new gitdir server and attempts to load the config from the admin repo.

(fs billy.Filesystem)

Source from the content-addressed store, hash-verified

30// NewServer configures a new gitdir server and attempts to load the config
31// from the admin repo.
32func NewServer(fs billy.Filesystem) (*Server, error) {
33 serv := &Server{
34 lock: &sync.RWMutex{},
35 log: log.Logger,
36 fs: fs,
37 }
38
39 serv.ssh = &ssh.Server{
40 Handler: serv.handleSession,
41 PublicKeyHandler: serv.handlePublicKey,
42 }
43
44 // This will set serv.settings
45 if err := serv.Reload(); err != nil {
46 return nil, err
47 }
48
49 return serv, nil
50}
51
52func (serv *Server) EnsureAdminUser(username string, pubKey *models.PublicKey) error {
53 serv.lock.Lock()

Callers

nothing calls this directly

Calls 1

ReloadMethod · 0.95

Tested by

no test coverage detected