mirror of
https://github.com/stulzq/azure-openai-proxy.git
synced 2025-12-18 14:54:19 +01:00
feat: allow changing the listening port (#70)
Allow changing the listening port via command line or configuration file. Signed-off-by: cubercsl <2014cais01@gmail.com>
This commit is contained in:
@@ -36,7 +36,7 @@ func main() {
|
||||
registerRoute(r)
|
||||
|
||||
srv := &http.Server{
|
||||
Addr: ":8080",
|
||||
Addr: viper.GetString("listen"),
|
||||
Handler: r,
|
||||
}
|
||||
|
||||
@@ -64,6 +64,7 @@ func runServer(srv *http.Server) {
|
||||
|
||||
func parseFlag() {
|
||||
pflag.StringP("configFile", "c", "config.yaml", "config file")
|
||||
pflag.StringP("listen", "l", ":8080", "listen address")
|
||||
pflag.BoolP("version", "v", false, "version information")
|
||||
pflag.Parse()
|
||||
if err := viper.BindPFlags(pflag.CommandLine); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user