Skip to content

Commit

Permalink
get version from txt file
Browse files Browse the repository at this point in the history
  • Loading branch information
l-trotta committed May 7, 2024
1 parent af747b2 commit 2f990e7
Showing 1 changed file with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
package co.elastic.clients.transport;

import javax.annotation.Nullable;
import java.io.BufferedReader;
import java.io.FileReader;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Objects;

/**
Expand Down Expand Up @@ -146,8 +150,14 @@ public String toString() {

static {
Version version = null;
try {
version = Version.parse(VersionInfo.VERSION);
String dir = System.getProperty("user.dir");
String filename = "version.txt";
if(VersionInfo.FLAVOR.equals("serverless")){
filename = "version-serverless.txt";
}
Path path = Paths.get(dir, "config", filename);
try(BufferedReader vsReader = new BufferedReader(new FileReader(path.toFile()))) {
version = Version.parse(vsReader.readLine());
} catch (Exception e) {
// Failed to parse version
}
Expand Down

0 comments on commit 2f990e7

Please sign in to comment.