| Line 56... |
Line 56... |
| 56 |
Map<String, Object> attributesMap = new HashMap<>();
|
56 |
Map<String, Object> attributesMap = new HashMap<>();
|
| 57 |
DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("dd/MM/yyyy");
|
57 |
DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("dd/MM/yyyy");
|
| 58 |
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("dd/MM/yyyy H:m");
|
58 |
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("dd/MM/yyyy H:m");
|
| 59 |
attributesMap.put("dateFormatter", dateFormatter);
|
59 |
attributesMap.put("dateFormatter", dateFormatter);
|
| 60 |
attributesMap.put("dateTimeFormatter", dateTimeFormatter);
|
60 |
attributesMap.put("dateTimeFormatter", dateTimeFormatter);
|
| 61 |
attributesMap.put("version", "66");
|
61 |
attributesMap.put("version", "67");
|
| 62 |
attributesMap.put("cssVersion", "8");
|
62 |
attributesMap.put("cssVersion", "8");
|
| - |
|
63 |
attributesMap.put("isDev", getActiveProfile().equals("dev"));
|
| 63 |
bean.setAttributesMap(attributesMap);
|
64 |
bean.setAttributesMap(attributesMap);
|
| 64 |
return bean;
|
65 |
return bean;
|
| 65 |
}
|
66 |
}
|
| 66 |
|
67 |
|
| 67 |
@Bean
|
68 |
@Bean
|
| Line 91... |
Line 92... |
| 91 |
return new CommonsMultipartResolver();
|
92 |
return new CommonsMultipartResolver();
|
| 92 |
}
|
93 |
}
|
| 93 |
|
94 |
|
| 94 |
@Bean
|
95 |
@Bean
|
| 95 |
public PropertySourcesPlaceholderConfigurer propertyConfigurer1() {
|
96 |
public PropertySourcesPlaceholderConfigurer propertyConfigurer1() {
|
| 96 |
String activeProfile;
|
97 |
String activeProfile = getActiveProfile();
|
| 97 |
|
98 |
|
| 98 |
PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer = new PropertySourcesPlaceholderConfigurer();
|
99 |
PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer = new PropertySourcesPlaceholderConfigurer();
|
| 99 |
|
100 |
|
| 100 |
Properties properties = new Properties();
|
- |
|
| 101 |
try {
|
- |
|
| 102 |
properties.load(this.getClass().getClassLoader().getResourceAsStream("META-INF/env.property"));
|
- |
|
| 103 |
} catch (IOException e) {
|
- |
|
| 104 |
LOGGER.error("Error in reading env property file.Adding default property" + e);
|
- |
|
| 105 |
properties.put("profile", "dev");
|
- |
|
| 106 |
}
|
- |
|
| 107 |
activeProfile = (String) properties.get("profile");
|
- |
|
| 108 |
|
- |
|
| 109 |
if ("prod".equals(activeProfile)) {
|
101 |
if ("prod".equals(activeProfile)) {
|
| 110 |
resource = new ClassPathResource("/META-INF/prod.properties");
|
102 |
resource = new ClassPathResource("/META-INF/prod.properties");
|
| 111 |
} else if ("staging".equals(activeProfile)) {
|
103 |
} else if ("staging".equals(activeProfile)) {
|
| 112 |
resource = new ClassPathResource("/META-INF/staging.properties");
|
104 |
resource = new ClassPathResource("/META-INF/staging.properties");
|
| 113 |
} else {
|
105 |
} else {
|
| Line 117... |
Line 109... |
| 117 |
propertySourcesPlaceholderConfigurer.setLocation(resource);
|
109 |
propertySourcesPlaceholderConfigurer.setLocation(resource);
|
| 118 |
|
110 |
|
| 119 |
return propertySourcesPlaceholderConfigurer;
|
111 |
return propertySourcesPlaceholderConfigurer;
|
| 120 |
}
|
112 |
}
|
| 121 |
|
113 |
|
| - |
|
114 |
private String getActiveProfile() {
|
| - |
|
115 |
Properties properties = new Properties();
|
| - |
|
116 |
try {
|
| - |
|
117 |
properties.load(this.getClass().getClassLoader().getResourceAsStream("META-INF/env.property"));
|
| - |
|
118 |
} catch (IOException e) {
|
| - |
|
119 |
LOGGER.error("Error in reading env property file.Adding default property" + e);
|
| - |
|
120 |
properties.put("profile", "dev");
|
| - |
|
121 |
}
|
| - |
|
122 |
LOGGER.info("Profile is [{}]", properties.get("profile"));
|
| - |
|
123 |
return (String) properties.get("profile");
|
| - |
|
124 |
}
|
| - |
|
125 |
|
| 122 |
@Bean(name = "mailSender")
|
126 |
@Bean(name = "mailSender")
|
| 123 |
public JavaMailSender getSendgridMailSender() {
|
127 |
public JavaMailSender getSendgridMailSender() {
|
| 124 |
JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
|
128 |
JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
|
| 125 |
|
129 |
|
| 126 |
// Using gmail
|
130 |
// Using gmail
|