diff --git a/README.md b/README.md index c4471dc..fb9b21a 100644 --- a/README.md +++ b/README.md @@ -60,9 +60,11 @@ docker compose up Start the service with tracing enabled: ```shell -TRACING_ENABLED=true COLLECTOR_ENDPOINT="http://localhost:4317" mvn compile exec:java +MAVEN_OPTS="-Djava.io.tmpdir=target/classes/static-resources" TRACING_ENABLED=true COLLECTOR_ENDPOINT="http://localhost:4317" mvn compile exec:java ``` +**Note**: The MAVEN_OPTS is only required if you are using a local file system (i.e. no `GOOGLE_APPLICATION_CREDENTIALS` provided) + ## Using the Application Once the application is running (default port: 9000), you can interact with it through multiple interfaces: diff --git a/src/main/java/akka/haiku/storage/infrastructure/LocalStorage.java b/src/main/java/akka/haiku/storage/infrastructure/LocalStorage.java index 7ca9cf4..8f5e45d 100644 --- a/src/main/java/akka/haiku/storage/infrastructure/LocalStorage.java +++ b/src/main/java/akka/haiku/storage/infrastructure/LocalStorage.java @@ -18,7 +18,9 @@ public String uploadPng(byte[] data, String pathPrefix, String namePrefix) { Files.write(tempFile, data); - return "file://"+tempFile.toAbsolutePath(); + //This relies on the param MAVEN_OPTS="-Djava.io.tmpdir=target/classes/static-resources" + // being supplied to override the temp file to go to the server static file location + return "/static/"+tempFile.getFileName().toString(); } catch (IOException e) { log.error("Error while trying to store the PNG file", e); throw new RuntimeException(e);