planServices function
List<ServicePlan>
planServices(
- List<
RevaliService> services, { - int basePort = 8080,
- List<
String> only = const [],
Decides what to run and on which ports.
Separated from the process handling so the decisions — selection, port assignment, label uniqueness — are testable without starting anything.
Implementation
List<ServicePlan> planServices(
List<RevaliService> services, {
int basePort = 8080,
List<String> only = const [],
}) {
final selected = _select(services, only);
final labels = _labelsFor(selected);
return [
for (final (index, service) in selected.indexed)
ServicePlan(
service: service,
port: basePort + index,
label: labels[index],
),
];
}