40 lines
561 B
Go
40 lines
561 B
Go
package main
|
|
|
|
import (
|
|
"cimeyclust.com/steel/pkg/cmd"
|
|
"cimeyclust.com/steel/pkg/net"
|
|
"context"
|
|
"sync"
|
|
)
|
|
|
|
func main() {
|
|
// Channel for stopping the program
|
|
ctx, cancel := context.WithCancel(context.Background())
|
|
defer cancel()
|
|
|
|
var wg sync.WaitGroup
|
|
|
|
// Start the console handler
|
|
wg.Add(1)
|
|
go func() {
|
|
defer wg.Done()
|
|
|
|
defer cancel()
|
|
|
|
cmd.Run(ctx)
|
|
}()
|
|
|
|
// Start the network server
|
|
wg.Add(1)
|
|
go func() {
|
|
defer wg.Done()
|
|
|
|
net.Run(ctx, "localhost:8080")
|
|
}()
|
|
|
|
cmd.Logger.Info("Started")
|
|
|
|
// Wait for all components to finish
|
|
wg.Wait()
|
|
}
|