grim/hgkeeper

8f41bf671a91
Remove the access function as it's no longer needed
package serve
import (
"path/filepath"
"bitbucket.org/rw_grim/hgkeeper/access"
"bitbucket.org/rw_grim/hgkeeper/globals"
"bitbucket.org/rw_grim/hgkeeper/ssh"
)
type Command struct {
SSHAddr string `kong:"flag,name='ssh-listen-addr',env='HGK_SSH_LISTEN_ADDR',short='l',help='what address to listen on',default=':22222'"`
SSHHostKeysPath string `kong:"flag,name='ssh-host-keys-path',env='HGK_SSH_HOST_KEYS_PATH',short='H',help='the path where host keys are kept',default='host-keys'"`
}
func (c *Command) Run(g *globals.Globals) error {
adminRepoPath := filepath.Join(g.ReposPath, g.AdminRepo)
if err := access.Refresh(adminRepoPath); err != nil {
return err
}
s, err := ssh.NewServer(c.SSHHostKeysPath, g.ReposPath, g.AdminRepo)
if err != nil {
return err
}
err = s.Listen(c.SSHAddr)
if err != nil {
return err
}
return nil
}