package com.emc.ecs.serviceBroker.config;

import java.net.URL;

import org.cloudfoundry.community.servicebroker.model.BrokerApiVersion;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

import com.emc.ecs.managementClient.Connection;
import com.emc.ecs.serviceBroker.repository.EcsRepositoryCredentials;

@Configuration
@ComponentScan(basePackages = "com.emc.ecs.serviceBroker")
public class BrokerConfig {

	@Bean
	public Connection ecsConnection() {
		URL certificate = getClass().getClassLoader().getResource("localhost.pem");
		return new Connection("https://104.197.239.202:4443", "root", "ChangeMe", certificate);
	}
	
	@Bean
	public BrokerApiVersion brokerApiVersion() {
		return new BrokerApiVersion("2.7");
	}
	
	@Bean
	public EcsRepositoryCredentials getRepositoryCredentials() {
		return new EcsRepositoryCredentials("ecs-cf-service-broker-repository", "ecs-cf-service-broker-repository",
				"ns1", "urn:storageos:ReplicationGroupInfo:f81a7335-cadf-48fb-8eda-4856b250e9de:global");
	}

}
@@ -126,24 +126,83 @@
 ApiVersion;%0A
+import org.springframework.beans.factory.annotation.Value;%0A
 import org.s
@@ -237,24 +237,24 @@
 ation.Bean;%0A
-
 import org.s
@@ -584,16 +584,334 @@
 Config %7B
+%0A%09%0A%09@Value(%22$%7Bendpoint%7D%22)%0A%09private String endpoint;%0A%09%0A%09@Value(%22$%7Bport%7D%22)%0A%09private String port;%0A%09%0A%09@Value(%22$%7Busername%7D%22)%0A%09private String username;%0A%09%0A%09@Value(%22$%7Bpassword%7D%22)%0A%09private String password;%0A%09%0A%09@Value(%22$%7BreplicationGroup%7D%22)%0A%09private String replicationGroup;%0A%09%0A%09@Value(%22$%7Bnamespace%7D%22)%0A%09private String namespace;%0A%09
 %0A%0A%09@Bean
@@ -1063,49 +1063,53 @@
 s://
-104.197.239.202:4443%22, %22root%22, %22ChangeMe%22
+%22 + endpoint + %22:%22 + port, username, password
 , ce
@@ -1332,175 +1332,50 @@
 als(
-%22ecs-cf-service-broker-repository%22, %22ecs-cf-service-broker-repository%22,%0A%09%09%09%09%22ns1%22, %22urn:storageos:ReplicationGroupInfo:f81a7335-cadf-48fb-8eda-4856b250e9de:global%22
+null, null, namespace, replicationGroup
 );%0A%09%7D%0A
-%0A
 %7D

Add connection details as environment variables