Missing get_active_tech handler
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Adam Štrauch 2023-04-24 22:24:37 +02:00
parent 37a5297c88
commit 1ccf4b8301
Signed by: cx
GPG Key ID: 018304FFA8988F8D

View File

@ -52,6 +52,7 @@ func _messageHandler(m *nats.Msg) error {
"restart": restartEventHandler, "restart": restartEventHandler,
"get_deploy_ssh_keys": getDeploySSHKeysEventHandler, "get_deploy_ssh_keys": getDeploySSHKeysEventHandler,
"get_ssh_host_key": getSSHHostKeyEventHandler, "get_ssh_host_key": getSSHHostKeyEventHandler,
"get_active_tech": getActiveTechHandler,
"update_keys": updateKeysEventHandler, "update_keys": updateKeysEventHandler,
"set_password": setPasswordEventHandler, "set_password": setPasswordEventHandler,
"processes": processesEventHandler, "processes": processesEventHandler,
@ -1059,3 +1060,39 @@ func deleteAppSnapshotsEventHandler(m *nats.Msg, message *RequestMessage) error
return nil return nil
} }
func getActiveTechHandler(m *nats.Msg, message *RequestMessage) error {
processor := glue.Processor{
AppName: message.AppName,
DB: common.GetDBConnection(),
SnapshotProcessor: &snapshotProcessor,
DockerSock: config.DockerSocket,
BindIPHTTP: config.AppsBindIPHTTP,
BindIPSSH: config.AppsBindIPSSH,
AppsPath: config.AppsPath,
}
tech, err := processor.GetActiveTech()
if err != nil {
log.Printf("backend error: %v\n", err)
return errorReplyFormater(m, "backend error", err)
}
// Assembling reply message
reply := ReplyMessage{
Payload: tech,
}
data, err := json.Marshal(reply)
if err != nil {
return errorReplyFormater(m, "reply formatter error", err)
}
err = m.Respond(data)
if err != nil {
log.Println("ERROR: get app:", err.Error())
return err
}
return nil
}