Skip to content

Commit

Permalink
Rename env variable prefix from VITE_ to PUBLIC_ . Added logs in Proc…
Browse files Browse the repository at this point in the history
…essUtil
  • Loading branch information
satran004 committed Jan 5, 2025
1 parent 35999e3 commit 820326b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.bloxbean.cardano.yacicli.commands.common.ExecutorHelper;
import com.bloxbean.cardano.yacicli.localcluster.ClusterConfig;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.io.IOException;
Expand All @@ -21,6 +22,7 @@

@Component
@RequiredArgsConstructor
@Slf4j
public class ProcessUtil {
private final ExecutorHelper executorHelper;
private final ClusterConfig clusterConfig;
Expand Down Expand Up @@ -96,12 +98,12 @@ public String createProcessId(String processName, Process process) {
// Validate the yaciCliHome directory
Path homePath = Paths.get(yaciCliHome);
if (!Files.exists(homePath)) {
writeLn(error("yaci-cli home directory does not exist: " + yaciCliHome));
log.debug("yaci-cli home directory does not exist: " + yaciCliHome);
return null;
}

if (!Files.isDirectory(homePath)) {
writeLn(error("yaci-cli home path is not a directory: " + yaciCliHome));
log.debug("yaci-cli home path is not a directory: " + yaciCliHome);
return null;
}

Expand Down Expand Up @@ -140,18 +142,18 @@ public void killRunningProcesses() {
// Validate the yaciCliHome directory
Path homePath = Paths.get(yaciCliHome);
if (!Files.exists(homePath)) {
writeLn(error("The yaciCliHome directory does not exist: " + yaciCliHome));
log.debug("The yaciCliHome directory does not exist: " + yaciCliHome);
return;
}
if (!Files.isDirectory(homePath)) {
writeLn(error("The yaciCliHome path is not a directory: " + yaciCliHome));
log.debug("The yaciCliHome path is not a directory: " + yaciCliHome);
return;
}

// Resolve the pids directory
Path pidsDir = homePath.resolve("pids");
if (!Files.exists(pidsDir) || !Files.isDirectory(pidsDir)) {
writeLn(error("The pids directory does not exist or is not a directory: " + pidsDir));
log.debug("The pids directory does not exist or is not a directory: " + pidsDir);
return;
}

Expand All @@ -165,11 +167,11 @@ public void killRunningProcesses() {
pidList.add(Long.parseLong(pidString));
}
} catch (IOException | NumberFormatException e) {
writeLn(error("Failed to read or parse PID file: " + pidFile + " - " + e.getMessage()));
log.debug("Failed to read or parse PID file: " + pidFile + " - " + e.getMessage());
}
}
} catch (IOException e) {
writeLn(error("Failed to list PID files in directory: " + pidsDir + " : " + e.getMessage()));
log.debug("Failed to list PID files in directory: " + pidsDir + " : " + e.getMessage());
return;
}

Expand All @@ -184,13 +186,13 @@ public void killRunningProcesses() {
});
var result = processHandle.destroyForcibly();
if (!result) {
writeLn(error("Failed to kill process with PID : " + pid));
log.debug("Failed to kill process with PID : " + pid);
} else {
deletedPids.add(processHandle.pid());
}
});
} catch (Exception e) {
writeLn(error("Failed to kill process with PID: " + pid + " - " + e.getMessage()));
log.debug("Failed to kill process with PID: " + pid + " - " + e.getMessage());
}
}

Expand Down
4 changes: 2 additions & 2 deletions applications/viewer/env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#Rename this file to .env to set these variables
VITE_INDEXER_BASE_URL=http://localhost:8080/api/v1
VITE_INDEXER_WS_URL=ws://localhost:8080/ws/liveblocks
PUBLIC_INDEXER_BASE_URL=http://localhost:8080/api/v1
PUBLIC_INDEXER_WS_URL=ws://localhost:8080/ws/liveblocks
4 changes: 2 additions & 2 deletions config/env
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ HOST_KUPO_PORT=1442
#######################################################
# Viewer Config - DON'T CHANGE
#######################################################
VITE_INDEXER_BASE_URL=http://yaci-cli:8080/api/v1
VITE_INDEXER_WS_URL=ws://localhost:${HOST_STORE_API_PORT}/ws/liveblocks
PUBLIC_INDEXER_BASE_URL=http://yaci-cli:8080/api/v1
PUBLIC_INDEXER_WS_URL=ws://localhost:${HOST_STORE_API_PORT}/ws/liveblocks
IS_DOCKER=true

#######################################################
Expand Down

0 comments on commit 820326b

Please sign in to comment.