Make handler() send more status messages over Matrix (fix #14)

This commit is contained in:
Noah 2024-03-11 17:55:13 -05:00
parent 841dda8f8f
commit 72c5467ae2

View File

@ -35,16 +35,20 @@ func handler(data map[string]interface{}) {
deploy_error.SendOverMatrix(); return
}
if exists {
sendMessage(MatrixMessage{text: "⚪️ Updating repository..."})
if deploy_error := site.Update(); deploy_error.code != 0 {
deploy_error.SendOverMatrix(); return
}
sendMessage(MatrixMessage{text: "⚪️ Restarting server..."})
if deploy_error := site.Restart(); deploy_error.code != 0 {
deploy_error.SendOverMatrix(); return
}
} else {
sendMessage(MatrixMessage{text: "⚪️ Cloning repository..."})
if deploy_error := CloneSite(repository["ssh_url"].(string), repo_name); deploy_error.code != 0 {
deploy_error.SendOverMatrix(); return
}
sendMessage(MatrixMessage{text: "⚪️ Starting server..."})
if site, exists, err = getSite(repo_name); err != nil {
deploy_error := newDeployError(1, "handler", "Failed to get site '%s' after creation!", fmt.Sprint(err))
deploy_error.SendOverMatrix()
@ -52,6 +56,7 @@ func handler(data map[string]interface{}) {
if deploy_error := site.Start(); deploy_error.code != 0 {
deploy_error.SendOverMatrix(); return
}
defer sendMessage(MatrixMessage{text: "🚀 Launched for the first time!"})
}
sendMessage(MatrixMessage{text: "🟢 Deployed successfully!"})
}