mirror of
https://github.com/OwO-Network/DeepLX.git
synced 2025-06-21 14:13:23 +00:00
feat: Read PORT envvar
This commit is contained in:
parent
f9f378e7eb
commit
cb0bdf9028
10
main.go
10
main.go
@ -8,6 +8,7 @@ import (
|
||||
"log"
|
||||
"math/rand"
|
||||
"net/http"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@ -115,7 +116,6 @@ func main() {
|
||||
"code": 200,
|
||||
"message": "DeepL Free API, Made by sjlleo and missuo. Go to /translate with POST. http://github.com/OwO-Network/DeepLX",
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
r.POST("/translate", func(c *gin.Context) {
|
||||
@ -225,5 +225,11 @@ func main() {
|
||||
}
|
||||
}
|
||||
})
|
||||
r.Run(":1188") // listen and serve on 0.0.0.0:1188
|
||||
|
||||
port, ok := os.LookupEnv("PORT")
|
||||
if ok {
|
||||
r.Run(":" + port)
|
||||
} else {
|
||||
r.Run(":1188") // listen and serve on 0.0.0.0:1188
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user