diff --git a/bin/datasophon-api.sh b/bin/datasophon-api.sh
index 72812101..877e8992 100644
--- a/bin/datasophon-api.sh
+++ b/bin/datasophon-api.sh
@@ -158,7 +158,7 @@ case $startStop in
fi
echo starting $command, logging to $log
- exec_command="$DDH_OPTS -classpath $DDH_CONF_DIR:$DDH_LIB_JARS $CLASS"
+ exec_command="$DDH_OPTS -Dspring.profiles.active=config -classpath $DDH_CONF_DIR:$DDH_LIB_JARS $CLASS"
echo "nohup $JAVA $exec_command > $log 2>&1 &"
nohup $JAVA $exec_command > $log 2>&1 &
diff --git a/datasophon-api/pom.xml b/datasophon-api/pom.xml
index e38e9164..59cfec2e 100644
--- a/datasophon-api/pom.xml
+++ b/datasophon-api/pom.xml
@@ -46,6 +46,11 @@
datasophon-ui
${project.version}
+
+
+ org.eclipse.jetty
+ jetty-proxy
+
diff --git a/datasophon-api/src/main/java/com/datasophon/api/configuration/AppConfiguration.java b/datasophon-api/src/main/java/com/datasophon/api/configuration/AppConfiguration.java
index a603bccf..13b236ff 100644
--- a/datasophon-api/src/main/java/com/datasophon/api/configuration/AppConfiguration.java
+++ b/datasophon-api/src/main/java/com/datasophon/api/configuration/AppConfiguration.java
@@ -96,6 +96,7 @@ public void addInterceptors(InterceptorRegistry registry) {
// login
registry.addInterceptor(loginInterceptor())
.addPathPatterns("/**").excludePathPatterns("/login", "/error",
+ "/grafana/**",
"/service/install/downloadPackage",
"/service/install/downloadResource",
"/cluster/alert/history/save",
diff --git a/datasophon-api/src/main/java/com/datasophon/api/configuration/ConfigPropertiesExtend.java b/datasophon-api/src/main/java/com/datasophon/api/configuration/ConfigPropertiesExtend.java
index 6b4c48bd..01d09b3e 100644
--- a/datasophon-api/src/main/java/com/datasophon/api/configuration/ConfigPropertiesExtend.java
+++ b/datasophon-api/src/main/java/com/datasophon/api/configuration/ConfigPropertiesExtend.java
@@ -36,8 +36,27 @@ public class ConfigPropertiesExtend implements EnvironmentPostProcessor {
@Override
public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) {
MutablePropertySources propertySources = environment.getPropertySources();
+
+ // load the datasophon configuration (config/profiles/application-config.yml)
+ List activeProfiles = Arrays.asList(environment.getActiveProfiles());
+ if (!activeProfiles.isEmpty() && !Collections.singletonList("config").containsAll(activeProfiles)) {
+ // running other profiles
+ return;
+ }
+ try {
+ List> configPropertySources = new YamlPropertySourceLoader().load(DEFAULT_APPLICATION_CONFIG, new FileSystemResource(DEFAULT_APPLICATION_CONFIG));
+ if (!CollectionUtils.isEmpty(configPropertySources)) {
+ for (PropertySource> propertySource : configPropertySources) {
+ propertySources.addFirst(propertySource);
+ }
+ }
+ } catch (Exception e) {
+ System.err.println("Default config application-config not found ");
+ log.error("Default config application-config not found", e);
+ }
+
+ // load the datasophon configuration (config/datasophon.conf)
Properties properties = loadCustomProperties();
- checkProfile(environment);
propertySources.addFirst(new PropertiesPropertySource("datasophonConfig", properties));
}
@@ -47,8 +66,7 @@ private Properties loadCustomProperties() {
try (InputStream inputStream = Files.newInputStream(file.toPath())) {
properties.load(inputStream);
} catch (Exception e) {
- System.err.println(
- "Failed to load the datart configuration (config/datart.conf), use application-config.yml");
+ System.err.println("Failed to load the datasophon configuration (config/datasophon.conf), use application-config.yml");
return new Properties();
}
List