-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.go
35 lines (28 loc) · 885 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
package main
import (
"github.com/yomcube/GhostDB/routes"
"github.com/yomcube/GhostDB/sql"
"github.com/yomcube/GhostDB/utils"
"fmt"
"github.com/gin-gonic/gin"
)
func main() {
// Setup PostgreSQL (Still requires manual creation of the database)
fmt.Println("Setting up database...")
cfg, exit_code := sql.SetupConfig()
if exit_code == 1 {
fmt.Println("DB config does not exist! Creating default config and exiting...")
return
}
cfg.SetupDatabase()
// Setup folder structure
fmt.Println("Ensuring directories...")
utils.EnsureDirectory("rkg") // RKG Folder
utils.EnsureDirectory("miigx") // MiiGX Folder
utils.EnsureDirectory("mnms") // Cache of Mii Renders
fmt.Println("Initializing router...")
router := gin.Default()
routes.InitRoutes(router)
err := router.Run() // listen and serve on 0.0.0.0:8080 (for windows "localhost:8080")
utils.ErrPanic(err)
}