Add option to not publish ip

This commit is contained in:
Electroid 2017-08-08 10:51:57 -07:00
parent e52818d5f6
commit 9ea38d8cdb
3 changed files with 10 additions and 1 deletions

View File

@ -12,4 +12,6 @@ public interface MinecraftApiConfiguration extends ApiConfiguration {
String box(); String box();
ServerDoc.Role role(); ServerDoc.Role role();
boolean publishIp();
} }

View File

@ -37,6 +37,11 @@ public class MinecraftApiConfigurationImpl implements MinecraftApiConfiguration
return ServerDoc.Role.valueOf(config.getString("server.role").toUpperCase()); return ServerDoc.Role.valueOf(config.getString("server.role").toUpperCase());
} }
@Override
public boolean publishIp() {
return config.getBoolean("server.publishIp", true);
}
@Override @Override
public String primaryQueueName() { public String primaryQueueName() {
return "server." + serverId(); return "server." + serverId();

View File

@ -20,6 +20,7 @@ import com.google.common.io.Files;
import com.google.gson.Gson; import com.google.gson.Gson;
import tc.oc.api.docs.virtual.DeployInfo; import tc.oc.api.docs.virtual.DeployInfo;
import tc.oc.api.docs.virtual.ServerDoc; import tc.oc.api.docs.virtual.ServerDoc;
import tc.oc.api.minecraft.config.MinecraftApiConfiguration;
import tc.oc.commons.core.logging.Loggers; import tc.oc.commons.core.logging.Loggers;
import tc.oc.commons.core.util.Lazy; import tc.oc.commons.core.util.Lazy;
import tc.oc.minecraft.api.plugin.PluginFinder; import tc.oc.minecraft.api.plugin.PluginFinder;
@ -31,6 +32,7 @@ public class StartupServerDocument implements ServerDoc.Startup {
@Inject private Gson gson; @Inject private Gson gson;
@Inject private LocalServer minecraftServer; @Inject private LocalServer minecraftServer;
@Inject private PluginFinder pluginFinder; @Inject private PluginFinder pluginFinder;
@Inject private MinecraftApiConfiguration configuration;
private Logger logger; private Logger logger;
@Inject void init(Loggers loggers) { @Inject void init(Loggers loggers) {
@ -72,7 +74,7 @@ public class StartupServerDocument implements ServerDoc.Startup {
@Override @Override
public String ip() { public String ip() {
return ip.get(); return configuration.publishIp() ? ip.get() : null;
} }
@Override public Integer current_port() { @Override public Integer current_port() {