grim/hgkeeper
Clone
Summary
Browse
Changes
Graph
Add a log message saying that the ssh server is listening
feature/hgweb
2019-12-18, Gary Kramlich
c564dea8d263
Add a log message saying that the ssh server is listening
package
commands
import
(
"fmt"
"path/filepath"
"github.com/gliderlabs/ssh"
"bitbucket.org/rw_grim/hgkeeper/access"
"bitbucket.org/rw_grim/hgkeeper/hg"
)
type
Init
struct
{
repoPath
string
repoName
string
}
func
NewInit
(
reposPath
,
repoName
string
)
*
Init
{
return
&
Init
{
repoPath
:
filepath
.
Join
(
reposPath
,
repoName
),
repoName
:
repoName
,
}
}
func
(
i
*
Init
)
Run
(
session
ssh
.
Session
,
username
string
)
error
{
if
!
access
.
CanInit
(
username
,
"/"
+
i
.
repoName
)
{
return
fmt
.
Errorf
(
"access denied"
)
}
return
run
(
hg
.
Init
(
i
.
repoPath
),
session
)
}