-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.go
49 lines (38 loc) · 755 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package main
import (
"fmt"
"os"
"strconv"
"github.com/mazrean/separated-webshell/workspace/docker"
)
func main() {
strAPIPort := os.Getenv("API_PORT")
strSSHPort := os.Getenv("SSH_PORT")
apiPort, err := strconv.Atoi(strAPIPort)
if err != nil {
panic(err)
}
sshPort, err := strconv.Atoi(strSSHPort)
if err != nil {
panic(err)
}
server, close, err := InjectServer()
if err != nil {
panic(err)
}
defer close()
err = docker.Setup()
if err != nil {
panic(fmt.Errorf("failed to setup docker: %w", err))
}
err = server.Setup.Setup()
if err != nil {
panic(fmt.Errorf("failed to setup service: %w", err))
}
api := server.API
ssh := server.SSH
go func() {
panic(api.Start(apiPort))
}()
panic(ssh.Start(sshPort))
}