From 4af12ca340c9093ccd918df3fdfe53232f15dae7 Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Mon, 24 Nov 2025 13:56:54 +0100 Subject: [PATCH] jfjoch_viewer: Environment variables JUNGFRAUJOCH_HTTP_HOST and JUNGFRAUJOCH_HTTP_PORT --- viewer/JFJochViewerMenu.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/viewer/JFJochViewerMenu.cpp b/viewer/JFJochViewerMenu.cpp index 6be67c8a..c30005cf 100644 --- a/viewer/JFJochViewerMenu.cpp +++ b/viewer/JFJochViewerMenu.cpp @@ -127,12 +127,26 @@ void JFJochViewerMenu::openHttpSelected() { layout->addWidget(new QLabel(":"), 0, 2); QLineEdit *hostEdit = new QLineEdit(&dialog); - hostEdit->setText("localhost"); + + char *host = std::getenv("JUNGFRAUJOCH_HTTP_HOST"); + if (host != nullptr) + hostEdit->setText(host); + else + hostEdit->setText("localhost"); layout->addWidget(hostEdit, 0, 1); + QSpinBox *portSpinBox = new QSpinBox(&dialog); portSpinBox->setRange(1, 65535); - portSpinBox->setValue(5232); + + char *port_std = std::getenv("JUNGFRAUJOCH_HTTP_PORT"); + if (port_std != nullptr) { + const int tmp = std::stoi(std::string(port_std)); + if (tmp < 65536 && tmp > 0) + portSpinBox->setValue(tmp); + } else + portSpinBox->setValue(8080); + layout->addWidget(portSpinBox, 0, 3); QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);