Search in sources :

Example 6 with TelemetryConfig

use of org.terasology.config.TelemetryConfig in project Terasology by MovingBlocks.

the class TelemetrySubSystem method setTelemetryDestination.

private void setTelemetryDestination(Context rootContext) {
    Config config = rootContext.get(Config.class);
    TelemetryConfig telemetryConfig = config.getTelemetryConfig();
    String telemetryDestination = telemetryConfig.getTelemetryDestination();
    if (telemetryDestination != null) {
        try {
            URL url = new URL(telemetryDestination);
            TelemetryEmitter telemetryEmitter = (TelemetryEmitter) emitter;
            telemetryEmitter.changeUrl(url);
        } catch (MalformedURLException e) {
            logger.error("URL malformed", e);
        }
    } else {
        telemetryConfig.setTelemetryDestination(TelemetryEmitter.getDefaultCollectorURL(DEFAULT_COLLECTOR_PROTOCOL, DEFAULT_COLLECTOR_HOST, DEFAULT_COLLECTOR_PORT).toString());
    }
}
Also used : MalformedURLException(java.net.MalformedURLException) Config(org.terasology.config.Config) TelemetryConfig(org.terasology.config.TelemetryConfig) TelemetryEmitter(org.terasology.telemetry.TelemetryEmitter) URL(java.net.URL) TelemetryConfig(org.terasology.config.TelemetryConfig)

Aggregations

TelemetryConfig (org.terasology.config.TelemetryConfig)6 Config (org.terasology.config.Config)4 URL (java.net.URL)3 TelemetryLogstashAppender (org.terasology.telemetry.logstash.TelemetryLogstashAppender)3 ServerInfo (org.terasology.config.ServerInfo)2 AddServerPopup (org.terasology.rendering.nui.layers.mainMenu.AddServerPopup)2 LoggerContext (ch.qos.logback.classic.LoggerContext)1 MalformedURLException (java.net.MalformedURLException)1 TelemetryConfiguration (org.terasology.config.facade.TelemetryConfiguration)1 TelemetryConfigurationImpl (org.terasology.config.facade.TelemetryConfigurationImpl)1 TranslationSystem (org.terasology.i18n.TranslationSystem)1 LaunchPopup (org.terasology.rendering.nui.layers.mainMenu.LaunchPopup)1 TelemetryEmitter (org.terasology.telemetry.TelemetryEmitter)1