Skip to content

Commit 35e9469

Browse files
author
Aaron Schlesinger
committed
ref(boot.go,pkg/builder.go,pkg/sshd/server.go): pull the hard-coded git home dir out of pkg/sshd
to prepare for the deleted app cleaner’s usage of it
1 parent 096fd61 commit 35e9469

3 files changed

Lines changed: 8 additions & 5 deletions

File tree

boot.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"log"
55
"os"
66
"runtime"
7+
"time"
78

89
cookoolog "github.com/Masterminds/cookoo/log"
910
"github.com/codegangsta/cli"
@@ -20,6 +21,8 @@ import (
2021
const (
2122
serverConfAppName = "deis-builder-server"
2223
gitReceiveConfAppName = "deis-builder-git-receive"
24+
gitHomeDir = "/home/git"
25+
cleanerPollDuration = 1 * time.Second // TODO: make this configurable
2326
)
2427

2528
func init() {
@@ -69,7 +72,7 @@ func main() {
6972
log.Printf("Starting SSH server on %s:%d", cnf.SSHHostIP, cnf.SSHHostPort)
7073
sshCh := make(chan int)
7174
go func() {
72-
sshCh <- pkg.RunBuilder(cnf.SSHHostIP, cnf.SSHHostPort, circ)
75+
sshCh <- pkg.RunBuilder(cnf.SSHHostIP, cnf.SSHHostPort, gitHomeDir, circ)
7376
}()
7477

7578
select {

pkg/builder.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const (
2727
// Git.
2828
//
2929
// Run returns on of the Status* status code constants.
30-
func RunBuilder(sshHostIP string, sshHostPort int, sshServerCircuit *sshd.Circuit) int {
30+
func RunBuilder(sshHostIP string, sshHostPort int, gitHomeDir string, sshServerCircuit *sshd.Circuit) int {
3131
reg, router, ocxt := cookoo.Cookoo()
3232
log.SetFlags(0) // Time is captured elsewhere.
3333

@@ -58,7 +58,7 @@ func RunBuilder(sshHostIP string, sshHostPort int, sshServerCircuit *sshd.Circui
5858
// Start the SSH service.
5959
// TODO: We could refactor Serve to be a command, and then run this as
6060
// a route.
61-
if err := sshd.Serve(reg, router, sshServerCircuit, cxt); err != nil {
61+
if err := sshd.Serve(reg, router, sshServerCircuit, gitHomeDir, cxt); err != nil {
6262
clog.Errf(cxt, "SSH server failed: %s", err)
6363
return StatusLocalError
6464
}

pkg/sshd/server.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ var (
5454
//
5555
// This puts the following variables into the context:
5656
// - ssh.Closer (chan interface{}): Send a message to this to shutdown the server.
57-
func Serve(reg *cookoo.Registry, router *cookoo.Router, serverCircuit *Circuit, c cookoo.Context) cookoo.Interrupt {
57+
func Serve(reg *cookoo.Registry, router *cookoo.Router, serverCircuit *Circuit, gitHomeDir string, c cookoo.Context) cookoo.Interrupt {
5858
hostkeys := c.Get(HostKeys, []ssh.Signer{}).([]ssh.Signer)
5959
addr := c.Get(Address, "0.0.0.0:2223").(string)
6060
cfg := c.Get(ServerConfig, &ssh.ServerConfig{}).(*ssh.ServerConfig)
@@ -71,7 +71,7 @@ func Serve(reg *cookoo.Registry, router *cookoo.Router, serverCircuit *Circuit,
7171

7272
srv := &server{
7373
c: c,
74-
gitHome: "/home/git",
74+
gitHome: gitHomeDir,
7575
}
7676

7777
closer := make(chan interface{}, 1)

0 commit comments

Comments
 (0)