diff options
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 28 |
1 files changed, 23 insertions, 5 deletions
@@ -6,6 +6,7 @@ import ( "git.hatecomputers.club/hatecomputers/hatecomputers.club/api" "git.hatecomputers.club/hatecomputers/hatecomputers.club/args" "git.hatecomputers.club/hatecomputers/hatecomputers.club/database" + "git.hatecomputers.club/hatecomputers/hatecomputers.club/dns" "git.hatecomputers.club/hatecomputers/hatecomputers.club/scheduler" "github.com/joho/godotenv" ) @@ -40,10 +41,27 @@ func main() { if argv.Server { server := api.MakeServer(argv, dbConn) - err = server.ListenAndServe() - if err != nil { - log.Fatal(err) - } - log.Println("🚀🚀 server listening on port", argv.Port) + log.Println("🚀🚀 API listening on port", argv.Port) + + go func() { + err = server.ListenAndServe() + if err != nil { + log.Fatal(err) + } + }() } + + if argv.Dns { + server := dns.MakeServer(argv, dbConn) + log.Println("🚀🚀 DNS resolver listening on port", argv.DnsPort) + go func() { + err = server.ListenAndServe() + if err != nil { + log.Fatal(err) + } + }() + } + + runForever := make(chan struct{}) + <-runForever } |
