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