frankgh commented on code in PR #47: URL: https://github.com/apache/cassandra-sidecar/pull/47#discussion_r1224668051
########## src/main/java/org/apache/cassandra/sidecar/MainModule.java: ########## @@ -311,4 +320,28 @@ public ChecksumVerifier checksumVerifier(Vertx vertx) { return new MD5ChecksumVerifier(vertx.fileSystem()); } + + @Provides + @Singleton + @Named("SidecarVersion") + public String sidecarVersion() + { + String resource = "/sidecar.version"; + try (InputStream input = NodeSettings.class.getResourceAsStream(resource); + ByteArrayOutputStream output = new ByteArrayOutputStream()) + { + byte[] buffer = new byte[32]; + int length; + while ((length = input.read(buffer)) >= 0) + { + output.write(buffer, 0, length); + } + return output.toString(StandardCharsets.UTF_8.name()); + } + catch (Exception exception) + { + LOGGER.error("Failed to retrieve Sidecar version from resource {}", resource, exception); Review Comment: Well, we will definitely not have the version for development, unit testing, or some gradle targets. Which means that we will need to handle those cases if we are going to go with that behavior. As Yuriy mentioned above, if the file is missing it means there was some issue during the build process. I think we should not worry much about that case. I'm leaning more towards not failing the startup for two reasons. The first reason is that we should/can rely on the build process to correctly generate the version file. The second reason is that we will need to handle the cases where it's fine to not have the version (i.e unit tests, gradlew run, etc) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org For additional commands, e-mail: pr-h...@cassandra.apache.org