Skip to content

Commit b595b2a

Browse files
author
kasemir
committed
Alarm server: Allow multiple -settings
Just like the phoebus GUI, it should allow multiple settings, like alarm-server -settings /path/to/global/settings.ini -settings /path/to/more/specific/settings.ini
1 parent d31ca94 commit b595b2a

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

services/alarm-server/src/main/java/org/phoebus/applications/alarm/server/AlarmServerMain.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2018-2023 Oak Ridge National Laboratory.
2+
* Copyright (c) 2018-2026 Oak Ridge National Laboratory.
33
* All rights reserved. This program and the accompanying materials
44
* are made available under the terms of the Eclipse Public License v1.0
55
* which accompanies this distribution, and is available at
@@ -544,13 +544,20 @@ public static void main(final String[] original_args) throws Exception {
544544
Map.entry(kafka_props_arg, "kafka_properties")
545545
);
546546

547+
// Allow more than one `-settings`
548+
List<String> setting_files = new ArrayList<>();
549+
547550
while (iter.hasNext()) {
548551
final String cmd = iter.next();
549552
if (options.contains(cmd)) {
550553
if (!iter.hasNext())
551554
throw new Exception("Missing argument for " + cmd);
552555
final String arg = iter.next();
553-
parsed_args.put(cmd, arg);
556+
// Accumulate -settings
557+
if (settings_arg.equals(cmd))
558+
setting_files.add(arg);
559+
else // other -cmd arg
560+
parsed_args.put(cmd, arg);
554561
} else if (flags.contains(cmd))
555562
parsed_args.put(cmd, "");
556563
else
@@ -564,8 +571,7 @@ public static void main(final String[] original_args) throws Exception {
564571
if (parsed_args.containsKey(logging_arg)) {
565572
LogManager.getLogManager().readConfiguration(new FileInputStream(parsed_args.get(logging_arg)));
566573
}
567-
if (parsed_args.containsKey(settings_arg)) {
568-
final String filename = parsed_args.get(settings_arg);
574+
for (String filename : setting_files) {
569575
logger.info("Loading settings from " + filename);
570576
PropertyPreferenceLoader.load(new FileInputStream(filename));
571577
final Preferences userPrefs = Preferences.userRoot().node("org/phoebus/applications/alarm");

0 commit comments

Comments
 (0)