DodoApp: Prepare dodo-app to support multiple app repositories

Previously Git repository storing configuration for PCloud
environment, linked dodo-app repositories directly. After this change,
dodo-app will first create config repository which will link
individual application repositories. And PCloud env will link to the
config repo. That way dodo-app manger will be able to create multiple
app repositories per installation.

Change-Id: I647cacda7a9a4f241d2acc28ae5d8bbd8c6424d6
diff --git a/apps/app-runner/main.go b/apps/app-runner/main.go
index 10d74ae..dce8ffe 100644
--- a/apps/app-runner/main.go
+++ b/apps/app-runner/main.go
@@ -16,6 +16,7 @@
 )
 
 var port = flag.Int("port", 3000, "Port to listen on")
+var appId = flag.String("app-id", "", "Application ID")
 var repoAddr = flag.String("repo-addr", "", "Git repository address")
 var sshKey = flag.String("ssh-key", "", "Private SSH key to access Git repository")
 var appDir = flag.String("app-dir", "", "Path to store application repository locally")
@@ -97,6 +98,6 @@
 	if err := json.NewDecoder(r).Decode(&cmds); err != nil {
 		panic(err)
 	}
-	s := NewServer(*port, *repoAddr, signer, *appDir, cmds, self, *manager)
+	s := NewServer(*port, *appId, *repoAddr, signer, *appDir, cmds, self, *manager)
 	s.Start()
 }
diff --git a/apps/app-runner/server.go b/apps/app-runner/server.go
index 865f724..7985ac6 100644
--- a/apps/app-runner/server.go
+++ b/apps/app-runner/server.go
@@ -16,6 +16,7 @@
 type Server struct {
 	l           sync.Locker
 	port        int
+	appId       string
 	ready       bool
 	cmd         *exec.Cmd
 	repoAddr    string
@@ -26,11 +27,12 @@
 	manager     string
 }
 
-func NewServer(port int, repoAddr string, signer ssh.Signer, appDir string, runCommands []Command, self string, manager string) *Server {
+func NewServer(port int, appId string, repoAddr string, signer ssh.Signer, appDir string, runCommands []Command, self string, manager string) *Server {
 	return &Server{
 		l:           &sync.Mutex{},
 		port:        port,
 		ready:       false,
+		appId:       appId,
 		repoAddr:    repoAddr,
 		signer:      signer,
 		appDir:      appDir,
@@ -118,6 +120,7 @@
 }
 
 type pingReq struct {
+	AppId   string `json:"appId"`
 	Address string `json:"address"`
 }
 
@@ -128,7 +131,7 @@
 			s.pingManager()
 		}()
 	}()
-	buf, err := json.Marshal(pingReq{s.self})
+	buf, err := json.Marshal(pingReq{s.appId, s.self})
 	if err != nil {
 		return
 	}