[Major] Refactored StrolchConfiguration.xml to use environments
Now the agent requires an environment parameter to start, and the configuration of that environment is used to load different sections of the configuration file Conflicts: src/main/java/li/strolch/tutorialwebapp/StartupListener.java
This commit is contained in:
parent
a6341da79b
commit
a05f6c10dd
81
pom.xml
81
pom.xml
|
@ -76,6 +76,15 @@
|
|||
|
||||
<build>
|
||||
<finalName>${warFinalName}</finalName>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
<includes>
|
||||
<include>**/componentVersion.properties</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
|
||||
<plugins>
|
||||
|
||||
|
@ -90,33 +99,43 @@
|
|||
<configuration>
|
||||
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||
<warName>${warFinalName}</warName>
|
||||
<webResources>
|
||||
<resource>
|
||||
<directory>src/main/non-packaged-resources</directory>
|
||||
<targetPath>WEB-INF</targetPath>
|
||||
<filtering>true</filtering>
|
||||
<includes>
|
||||
<include>**/ENV.properties</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</webResources>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>install-jar</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>copy</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<artifactItems>
|
||||
<artifactItem>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>${project.artifactId}</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>war</type>
|
||||
<outputDirectory>${project.build.directory}</outputDirectory>
|
||||
<destFileName>${project.artifactId}-${project.version}.war</destFileName>
|
||||
</artifactItem>
|
||||
</artifactItems>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<!-- <plugin> -->
|
||||
<!-- <artifactId>maven-dependency-plugin</artifactId> -->
|
||||
<!-- <executions> -->
|
||||
<!-- <execution> -->
|
||||
<!-- <id>install-jar</id> -->
|
||||
<!-- <phase>package</phase> -->
|
||||
<!-- <goals> -->
|
||||
<!-- <goal>copy</goal> -->
|
||||
<!-- </goals> -->
|
||||
<!-- <configuration> -->
|
||||
<!-- <artifactItems> -->
|
||||
<!-- <artifactItem> -->
|
||||
<!-- <groupId>${project.groupId}</groupId> -->
|
||||
<!-- <artifactId>${project.artifactId}</artifactId> -->
|
||||
<!-- <version>${project.version}</version> -->
|
||||
<!-- <type>war</type> -->
|
||||
<!-- <outputDirectory>${project.build.directory}</outputDirectory> -->
|
||||
<!-- <destFileName>${project.artifactId}-${project.version}.war</destFileName> -->
|
||||
<!-- </artifactItem> -->
|
||||
<!-- </artifactItems> -->
|
||||
<!-- </configuration> -->
|
||||
<!-- </execution> -->
|
||||
<!-- </executions> -->
|
||||
<!-- </plugin> -->
|
||||
|
||||
<plugin>
|
||||
<!-- Publish to Tomcat7: mvn tomcat7:redeploy -->
|
||||
|
@ -131,4 +150,18 @@
|
|||
</plugins>
|
||||
</build>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>m2e</id>
|
||||
<!-- This profile is only activated when building in Eclipse with m2e -->
|
||||
<activation>
|
||||
<property>
|
||||
<name>m2e.version</name>
|
||||
</property>
|
||||
</activation>
|
||||
<properties>
|
||||
<strolch.env>dev</strolch.env>
|
||||
</properties>
|
||||
</profile>
|
||||
</profiles>
|
||||
</project>
|
||||
|
|
|
@ -23,6 +23,7 @@ public class StartupListener implements ServletContextListener {
|
|||
public void contextInitialized(ServletContextEvent sce) {
|
||||
|
||||
String realPath = sce.getServletContext().getRealPath("/WEB-INF");
|
||||
|
||||
File pathF = new File(realPath);
|
||||
String environment = StrolchEnvironment.getEnvironmentFromEnvProperties(pathF);
|
||||
logger.info("Starting Agent...");
|
||||
|
|
Loading…
Reference in New Issue