-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
Refactored for native image support builds (#290)
Showing
23 changed files
with
330 additions
and
210 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
FROM ghcr.io/graalvm/graalvm-community:22 AS build | ||
|
||
ARG MAVEN_VERSION=3.9.9 | ||
ARG BASE_URL=https://apache.osuosl.org/maven/maven-3/${MAVEN_VERSION}/binaries | ||
|
||
RUN mkdir -p /usr/share/maven /usr/share/maven/ref | ||
ADD ${BASE_URL}/apache-maven-${MAVEN_VERSION}-bin.tar.gz /tmp/apache-maven.tar.gz | ||
RUN tar -xzf /tmp/apache-maven.tar.gz -C /usr/share/maven --strip-components=1 \ | ||
&& rm -f /tmp/apache-maven.tar.gz \ | ||
&& ln -s /usr/share/maven/bin/mvn /usr/bin/mvn | ||
|
||
WORKDIR /usr/src/app | ||
|
||
COPY pom.xml . | ||
RUN mvn dependency:go-offline | ||
|
||
COPY . . | ||
|
||
RUN mvn -DskipTests -Pprod -Pnative native:compile | ||
|
||
FROM debian:bookworm-slim | ||
|
||
WORKDIR /app | ||
|
||
COPY --from=build /usr/src/app/target/switcher-ac /app/switcher-ac | ||
|
||
CMD ["/app/switcher-ac"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 0 additions & 63 deletions
63
src/main/java/com/github/switcherapi/ac/config/SwitcherConfig.java
This file was deleted.
Oops, something went wrong.
32 changes: 30 additions & 2 deletions
32
src/main/java/com/github/switcherapi/ac/config/SwitcherFeatures.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,39 @@ | ||
package com.github.switcherapi.ac.config; | ||
|
||
import com.github.switcherapi.ac.util.FileUtil; | ||
import com.github.switcherapi.client.SnapshotCallback; | ||
import com.github.switcherapi.client.SwitcherContextBase; | ||
import com.github.switcherapi.client.SwitcherKey; | ||
import jakarta.annotation.PostConstruct; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
|
||
@Slf4j | ||
@Getter | ||
@Setter | ||
@ConfigurationProperties(prefix = "switcher") | ||
public class SwitcherFeatures extends SwitcherContextBase implements SnapshotCallback { | ||
|
||
public class SwitcherFeatures extends SwitcherContextBase { | ||
|
||
@SwitcherKey | ||
public static final String SWITCHER_AC_ADM = "SWITCHER_AC_ADM"; | ||
|
||
private String relayCode; | ||
|
||
@PostConstruct | ||
@Override | ||
protected void configureClient() { | ||
super.truststore.setPath(FileUtil.getFilePathFromResource(truststore.getPath())); | ||
super.configureClient(); | ||
|
||
scheduleSnapshotAutoUpdate(snapshot.getUpdateInterval(), this); | ||
checkSwitchers(); | ||
} | ||
|
||
@Override | ||
public void onSnapshotUpdate(long version) { | ||
log.info("Snapshot updated: {}", version); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.