forked from aurora-develop/aurora
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
44 lines (35 loc) · 721 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
36
37
38
39
40
41
42
43
44
package main
import (
"aurora/internal/tokens"
"github.com/gin-gonic/gin"
"github.com/joho/godotenv"
"os"
)
var HOST string
var PORT string
var ACCESS_TOKENS tokens.AccessToken
var PROXY_URL string
func init() {
_ = godotenv.Load(".env")
HOST = os.Getenv("SERVER_HOST")
PORT = os.Getenv("SERVER_PORT")
PROXY_URL = os.Getenv("PROXY_URL")
if HOST == "" {
HOST = "0.0.0.0"
}
if PORT == "" {
PORT = "8080"
}
}
func main() {
router := gin.Default()
router.Use(cors)
router.GET("/ping", func(c *gin.Context) {
c.JSON(200, gin.H{
"message": "pong",
})
})
router.OPTIONS("/v1/chat/completions", optionsHandler)
router.POST("/v1/chat/completions", nightmare)
router.Run(HOST + ":" + PORT)
}