Delete main.go
Browse files
main.go
DELETED
|
@@ -1,49 +0,0 @@
|
|
| 1 |
-
package main
|
| 2 |
-
|
| 3 |
-
import (
|
| 4 |
-
"aurora/initialize"
|
| 5 |
-
"embed"
|
| 6 |
-
"io/fs"
|
| 7 |
-
"log"
|
| 8 |
-
"net/http"
|
| 9 |
-
"os"
|
| 10 |
-
|
| 11 |
-
"github.com/gin-gonic/gin"
|
| 12 |
-
|
| 13 |
-
"github.com/acheong08/endless"
|
| 14 |
-
"github.com/joho/godotenv"
|
| 15 |
-
)
|
| 16 |
-
|
| 17 |
-
//go:embed web/*
|
| 18 |
-
var staticFiles embed.FS
|
| 19 |
-
|
| 20 |
-
func main() {
|
| 21 |
-
_ = godotenv.Load(".env")
|
| 22 |
-
gin.SetMode(gin.ReleaseMode)
|
| 23 |
-
router := initialize.RegisterRouter()
|
| 24 |
-
subFS, err := fs.Sub(staticFiles, "web")
|
| 25 |
-
if err != nil {
|
| 26 |
-
log.Fatal(err)
|
| 27 |
-
}
|
| 28 |
-
router.StaticFS("/web", http.FS(subFS))
|
| 29 |
-
host := os.Getenv("SERVER_HOST")
|
| 30 |
-
port := os.Getenv("SERVER_PORT")
|
| 31 |
-
tlsCert := os.Getenv("TLS_CERT")
|
| 32 |
-
tlsKey := os.Getenv("TLS_KEY")
|
| 33 |
-
|
| 34 |
-
if host == "" {
|
| 35 |
-
host = "0.0.0.0"
|
| 36 |
-
}
|
| 37 |
-
if port == "" {
|
| 38 |
-
port = os.Getenv("PORT")
|
| 39 |
-
if port == "" {
|
| 40 |
-
port = "7860"
|
| 41 |
-
}
|
| 42 |
-
}
|
| 43 |
-
|
| 44 |
-
if tlsCert != "" && tlsKey != "" {
|
| 45 |
-
_ = endless.ListenAndServeTLS(host+":"+port, tlsCert, tlsKey, router)
|
| 46 |
-
} else {
|
| 47 |
-
_ = endless.ListenAndServe(host+":"+port, router)
|
| 48 |
-
}
|
| 49 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|