From 050cbf1898c9717ffb29458b487ad54227a0a3fd Mon Sep 17 00:00:00 2001 From: Martin Kirchner Date: Mon, 1 Dec 2025 08:52:55 +0100 Subject: [PATCH] Initialize server port from INSTALL_PORT environment variable if provided If helm chart was deployed to use a non privileged port Apache Answer wrote wrong port (always 80) into config file. Then the pod restarted which ended in a crash loop as non-root users may not open privileged ports. --- internal/install/install_controller.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/internal/install/install_controller.go b/internal/install/install_controller.go index 08b4c9780..165eb2eba 100644 --- a/internal/install/install_controller.go +++ b/internal/install/install_controller.go @@ -191,6 +191,13 @@ func InitEnvironment(ctx *gin.Context) { c.I18n.BundleDir = path.I18nPath c.ServiceConfig.UploadPath = path.UploadFilePath + // Set server port from INSTALL_PORT environment variable if provided + installPort := os.Getenv("INSTALL_PORT") + if len(installPort) > 0 { + c.Server.HTTP.Addr = "0.0.0.0:" + installPort + c.Swaggerui.Address = ":" + installPort + } + if err := conf.RewriteConfig(confPath, c); err != nil { log.Errorf("rewrite config failed %s", err) handler.HandleResponse(ctx, errors.BadRequest(reason.ReadConfigFailed), nil)