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,
"get_deploy_ssh_keys": getDeploySSHKeysEventHandler,
"get_ssh_host_key": getSSHHostKeyEventHandler,
"get_active_tech": getActiveTechHandler,
"update_keys": updateKeysEventHandler,
"set_password": setPasswordEventHandler,
"processes": processesEventHandler,
@ -1059,3 +1060,39 @@ func deleteAppSnapshotsEventHandler(m *nats.Msg, message *RequestMessage) error
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
}