mirror of
				https://github.com/benbusby/farside.git
				synced 2025-10-31 14:38:57 -04:00 
			
		
		
		
	 6970db9c5b
			
		
	
	
		6970db9c5b
		
			
		
	
	
	
		
			
	
		
	
	
		
			Some checks are pending
		
		
	
	Tests / test (1.21.x, macos-latest) (push) Waiting to run
				
			Tests / test (1.21.x, ubuntu-latest) (push) Waiting to run
				
			Tests / test (1.21.x, windows-latest) (push) Waiting to run
				
			Tests / test (1.22.x, macos-latest) (push) Waiting to run
				
			Tests / test (1.22.x, ubuntu-latest) (push) Waiting to run
				
			Tests / test (1.22.x, windows-latest) (push) Waiting to run
				
			Tests / test (1.23.x, macos-latest) (push) Waiting to run
				
			Tests / test (1.23.x, ubuntu-latest) (push) Waiting to run
				
			Tests / test (1.23.x, windows-latest) (push) Waiting to run
				
			Cron init blocks the server from starting until it finishes, which is not ideal.
		
			
				
	
	
		
			39 lines
		
	
	
	
		
			593 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			39 lines
		
	
	
	
		
			593 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package main
 | |
| 
 | |
| import (
 | |
| 	"log"
 | |
| 	"os"
 | |
| 	"os/signal"
 | |
| 	"syscall"
 | |
| 
 | |
| 	"github.com/benbusby/farside/db"
 | |
| 	"github.com/benbusby/farside/server"
 | |
| 	"github.com/benbusby/farside/services"
 | |
| )
 | |
| 
 | |
| func main() {
 | |
| 	err := db.InitializeDB()
 | |
| 	if err != nil {
 | |
| 		log.Fatal(err)
 | |
| 	}
 | |
| 
 | |
| 	go func() {
 | |
| 		err = services.InitializeServices()
 | |
| 		if err != nil {
 | |
| 			log.Println("Error intializing services", err)
 | |
| 		}
 | |
| 	}()
 | |
| 
 | |
| 	go db.InitCronTasks()
 | |
| 
 | |
| 	signalChan := make(chan os.Signal, 1)
 | |
| 	signal.Notify(signalChan, os.Interrupt, syscall.SIGTERM)
 | |
| 
 | |
| 	go func() {
 | |
| 		<-signalChan
 | |
| 		_ = db.CloseDB()
 | |
| 		os.Exit(0)
 | |
| 	}()
 | |
| 
 | |
| 	server.RunServer()
 | |
| }
 |