mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
use properties file of git-commit-id-maven-plugin so we don't need to filter resources
This commit is contained in:
@@ -31,12 +31,6 @@
|
|||||||
|
|
||||||
<build>
|
<build>
|
||||||
<finalName>commafeed</finalName>
|
<finalName>commafeed</finalName>
|
||||||
<resources>
|
|
||||||
<resource>
|
|
||||||
<directory>src/main/resources</directory>
|
|
||||||
<filtering>true</filtering>
|
|
||||||
</resource>
|
|
||||||
</resources>
|
|
||||||
|
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
@@ -69,7 +63,8 @@
|
|||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
<configuration>
|
<configuration>
|
||||||
<generateGitPropertiesFile>false</generateGitPropertiesFile>
|
<generateGitPropertiesFile>true</generateGitPropertiesFile>
|
||||||
|
<generateGitPropertiesFilename>${project.build.outputDirectory}/git.properties</generateGitPropertiesFilename>
|
||||||
<failOnNoGitDirectory>false</failOnNoGitDirectory>
|
<failOnNoGitDirectory>false</failOnNoGitDirectory>
|
||||||
<failOnUnableToExtractRepoInfo>false</failOnUnableToExtractRepoInfo>
|
<failOnUnableToExtractRepoInfo>false</failOnUnableToExtractRepoInfo>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
package com.commafeed;
|
package com.commafeed;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.time.temporal.ChronoUnit;
|
import java.time.temporal.ChronoUnit;
|
||||||
import java.util.ResourceBundle;
|
import java.util.Properties;
|
||||||
|
|
||||||
import com.commafeed.backend.cache.RedisPoolFactory;
|
import com.commafeed.backend.cache.RedisPoolFactory;
|
||||||
import com.commafeed.frontend.session.SessionHandlerFactory;
|
import com.commafeed.frontend.session.SessionHandlerFactory;
|
||||||
@@ -20,9 +22,11 @@ import jakarta.validation.constraints.NotNull;
|
|||||||
import jakarta.validation.constraints.Positive;
|
import jakarta.validation.constraints.Positive;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
|
@Slf4j
|
||||||
public class CommaFeedConfiguration extends Configuration implements WebsocketBundleConfiguration {
|
public class CommaFeedConfiguration extends Configuration implements WebsocketBundleConfiguration {
|
||||||
|
|
||||||
public enum CacheType {
|
public enum CacheType {
|
||||||
@@ -53,10 +57,17 @@ public class CommaFeedConfiguration extends Configuration implements WebsocketBu
|
|||||||
private final String gitCommit;
|
private final String gitCommit;
|
||||||
|
|
||||||
public CommaFeedConfiguration() {
|
public CommaFeedConfiguration() {
|
||||||
ResourceBundle bundle = ResourceBundle.getBundle("application");
|
Properties properties = new Properties();
|
||||||
|
try (InputStream stream = getClass().getResourceAsStream("/git.properties")) {
|
||||||
|
if (stream != null) {
|
||||||
|
properties.load(stream);
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
|
||||||
this.version = bundle.getString("version");
|
this.version = properties.getProperty("git.build.version", "unknown");
|
||||||
this.gitCommit = bundle.getString("git.commit");
|
this.gitCommit = properties.getProperty("git.commit.id.abbrev", "unknown");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,2 +0,0 @@
|
|||||||
version=${project.version}
|
|
||||||
git.commit=${git.commit.id.abbrev}
|
|
||||||
Reference in New Issue
Block a user