summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go28
1 files changed, 23 insertions, 5 deletions
diff --git a/main.go b/main.go
index 4b92b1b..2991821 100644
--- a/main.go
+++ b/main.go
@@ -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
}