package io.muoncore.config.writers;

import io.muoncore.config.AutoConfiguration;
import io.muoncore.config.AutoConfigurationWriter;

/**
 * Check any docker link style configuration properties and rework them to know config formats.
 *
 * Primarily, AMQP transport
 *
 * docker.rabbitmq.port.5762.tcp.addr is aliased to amqp.transport.url and amqp.discovery.url
 *
 */
public class DockerLinkConfigurationWriter implements AutoConfigurationWriter {

    @Override
    public void writeConfiguration(AutoConfiguration config) {

        String rabbitMqUrl = config.getStringConfig("rabbitmq.port.5762.tcp.addr");

        if (config.getStringConfig("rabbitmq.port.5762.tcp.addr") != null) {
            config.getProperties().put("amqp.transport.url", rabbitMqUrl);
            config.getProperties().put("amqp.discovery.url", rabbitMqUrl);
        }
    }
}

@@ -279,34 +279,34 @@
 .rabbitmq.port.5
-7
 6
+7
 2.tcp.addr is al
@@ -582,34 +582,34 @@
 %22rabbitmq.port.5
-7
 6
+7
 2.tcp.addr%22);%0A%0A 
@@ -662,10 +662,10 @@
 rt.5
-7
 6
+7
 2.tc

Fix rabbitmq port.