[server] Support for changing server port (#7131)

## Description
Ref: https://github.com/ente-io/ente/issues/7122

## Tests
Tested locally
This commit is contained in:
Neeraj
2025-09-10 16:22:43 +05:30
committed by GitHub
2 changed files with 13 additions and 3 deletions

View File

@@ -858,7 +858,12 @@ func runServer(environment string, server *gin.Engine) {
log.Fatal(server.RunTLS(":443", certPath, keyPath))
} else {
server.Run(":8080")
port := 8080
if viper.IsSet("http.port") {
port = viper.GetInt("http.port")
}
log.Infof("starting server on port %d", port)
server.Run(fmt.Sprintf(":%d", port))
}
}

View File

@@ -71,8 +71,13 @@ log-file: ""
# HTTP connection parameters
http:
# If true, bind to 443 and use TLS.
# By default, this is false, and museum will bind to 8080 without TLS.
# The port to bind to.
# If not specified, defaults to 8080 (HTTP) or 443 (HTTPS with use-tls: true)
# port: 8080
# If true, use TLS for HTTPS connections.
# When true and port is not specified, defaults to port 443.
# When false and port is not specified, defaults to port 8080.
# use-tls: true
# Specify the base endpoints for various apps