Skip to content

Commit

Permalink
Actually use cli flags as settings values for the server
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexProgrammerDE committed Dec 3, 2024
1 parent 44e34c4 commit 44a0749
Showing 1 changed file with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@

import javax.inject.Inject;
import javax.inject.Provider;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.function.Consumer;
import java.util.function.Predicate;

Expand All @@ -61,9 +58,24 @@ public void registerListener(PropertyKey property, Consumer<JsonElement> listene
}

public InstanceConfig exportSettingsProto() {
gatherProviders();
return settingsSource.toProto();
}

public void gatherProviders() {
var settings = new HashMap<String, Map<String, JsonElement>>();
providers.forEach((namespace, properties) -> {
var namespaceMap = new HashMap<String, JsonElement>();
properties.forEach((key, provider) -> {
namespaceMap.put(key, provider.get());
});

settings.put(namespace, namespaceMap);
});

settingsSource = settingsSource.withSettings(settings);
}

public void loadFromString(String data, ProxyParser proxyParser) {
try {
var newProxies =
Expand Down

0 comments on commit 44a0749

Please sign in to comment.