package com.orange.config;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.orange.model.Credentials;

@Configuration
public class CredentialsConfig {
	@Value("#{ systemEnvironment['SERVICES_ID_CREDENTIALS_URI'] }")
	private String credentials_uri;
	@Value("#{ systemEnvironment['SERVICES_ID_CREDENTIALS_HOSTNAME'] }")
	private String credentials_hostname;
	@Value("#{ systemEnvironment['SERVICES_ID_CREDENTIALS_MYOWNKEY'] }")
	private String credentials_myownkey;
	
	@Bean
	public Credentials credentials(){
		Map<String, Object> credentials = new HashMap<String, Object>();
		credentials.put("uri", credentials_uri);
		if (credentials_hostname != null) {
			credentials.put("hostname", credentials_hostname);
		}
		if (credentials_myownkey != null) {
			credentials.put("myownkey", credentials_myownkey);
		}
		return new Credentials(credentials);
	}

}

@@ -754,16 +754,50 @@
 ect%3E();%0A
+%09%09if (credentials_uri != null) %7B%0A%09
 %09%09creden
@@ -831,16 +831,20 @@
 s_uri);%0A
+%09%09%7D%0A
 %09%09if (cr

debug for the case that SERVICES_ID_CREDENTIALS_URI is not set