feature: Adds backend system and basic API.
This adds the backend API, as well as backend infrastructure, including autostarting and basic communication between the Goroutine + Application.
This commit is contained in:
parent
611d7f24f8
commit
0b73b4aa47
12 changed files with 777 additions and 44 deletions
34
backend/api/backendruntime/struct.go
Normal file
34
backend/api/backendruntime/struct.go
Normal file
|
@ -0,0 +1,34 @@
|
|||
package backendruntime
|
||||
|
||||
import (
|
||||
"net"
|
||||
"os/exec"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type Backend struct {
|
||||
Name string `validate:"required"`
|
||||
Path string `validate:"required"`
|
||||
}
|
||||
|
||||
type Runtime struct {
|
||||
isRuntimeRunning bool
|
||||
logger *writeLogger
|
||||
currentProcess *exec.Cmd
|
||||
currentListener net.Listener
|
||||
|
||||
ProcessPath string
|
||||
Logs []string
|
||||
RuntimeCommands chan interface{}
|
||||
}
|
||||
|
||||
type writeLogger struct {
|
||||
Runtime *Runtime
|
||||
}
|
||||
|
||||
func (writer writeLogger) Write(p []byte) (n int, err error) {
|
||||
logSplit := strings.Split(string(p), "\n")
|
||||
writer.Runtime.Logs = append(writer.Runtime.Logs, logSplit...)
|
||||
|
||||
return len(p), err
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue