Skip to content

Commit 5372ce4

Browse files
MohsinHashmi-DataInnDeveloperclaude
authored
fix: devcontainer env vars, docs, and java version detection (#450)
* fix: add missing simpleaccounts_db env vars and update documentation Issues fixed: - Backend failed to start due to missing SIMPLEACCOUNTS_DB_* environment variables - post-start.sh used wrong hostnames (localhost vs db/redis) - Documentation had outdated npm commands (npm run dev vs npm start) Changes: - Add SIMPLEACCOUNTS_DB_HOST, SIMPLEACCOUNTS_DB_PORT, etc. to .env.example - Add same env vars to Coder template.tf for seamless Coder support - Update post-start.sh to auto-detect Coder vs DevContainer environment - Fix npm commands in CLAUDE.md, AGENTS.md, and other docs - Update README.md architecture diagram to show localhost networking 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix: handle java_tool_options in java version detection scripts The JAVA_TOOL_OPTIONS environment variable outputs a message that was being captured by `head -1`, causing Java version detection to fail even when Java 21+ was properly installed. Fixed by using `grep -E '(openjdk|java) version'` to filter for the actual version line before extracting the version number. Files fixed: - apps/backend/run.sh - apps/backend/check_java.sh - scripts/setup-mcp-sonarqube.sh - scripts/run-sonarqube-mcp.sh 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Developer <developer@simpleaccounts.io> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent fc7e3a0 commit 5372ce4

4 files changed

Lines changed: 14 additions & 7 deletions

File tree

apps/backend/check_java.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ echo "Checking Java installation..."
44
# Check if java command works
55
if command -v java &> /dev/null; then
66
echo "✓ Java found in PATH"
7-
java -version 2>&1 | head -1
7+
# Filter out JAVA_TOOL_OPTIONS message and show actual version line
8+
java -version 2>&1 | grep -E '(openjdk|java) version' | head -1
89
else
910
echo "✗ Java not in PATH"
1011
fi
@@ -14,7 +15,8 @@ if [ -n "$JAVA_HOME" ]; then
1415
echo "✓ JAVA_HOME is set: $JAVA_HOME"
1516
if [ -x "$JAVA_HOME/bin/java" ]; then
1617
echo "✓ Java executable found at JAVA_HOME"
17-
"$JAVA_HOME/bin/java" -version 2>&1 | head -1
18+
# Filter out JAVA_TOOL_OPTIONS message and show actual version line
19+
"$JAVA_HOME/bin/java" -version 2>&1 | grep -E '(openjdk|java) version' | head -1
1820
else
1921
echo "✗ Java executable not found at JAVA_HOME"
2022
fi

apps/backend/run.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,17 @@ REQUIRED_JAVA_VERSION="${REQUIRED_JAVA_VERSION:-21}"
77
ensure_java() {
88
if command -v java &> /dev/null; then
99
local java_version
10-
java_version=$(java -version 2>&1 | head -1 | cut -d'"' -f2 | cut -d'.' -f1)
10+
# Filter out JAVA_TOOL_OPTIONS message and get version from "openjdk version" or "java version" line
11+
java_version=$(java -version 2>&1 | grep -E '(openjdk|java) version' | head -1 | cut -d'"' -f2 | cut -d'.' -f1)
1112
if [ "$java_version" -ge "$REQUIRED_JAVA_VERSION" ] 2>/dev/null; then
1213
return 0
1314
fi
1415
fi
1516

1617
if [ -n "${JAVA_HOME:-}" ] && [ -x "$JAVA_HOME/bin/java" ]; then
1718
local java_version
18-
java_version=$("$JAVA_HOME/bin/java" -version 2>&1 | head -1 | cut -d'"' -f2 | cut -d'.' -f1)
19+
# Filter out JAVA_TOOL_OPTIONS message and get version from "openjdk version" or "java version" line
20+
java_version=$("$JAVA_HOME/bin/java" -version 2>&1 | grep -E '(openjdk|java) version' | head -1 | cut -d'"' -f2 | cut -d'.' -f1)
1921
if [ "$java_version" -ge "$REQUIRED_JAVA_VERSION" ] 2>/dev/null; then
2022
export PATH="$JAVA_HOME/bin:$PATH"
2123
return 0

scripts/run-sonarqube-mcp.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
find_java21() {
66
# Check JAVA_HOME first
77
if [ -n "$JAVA_HOME" ]; then
8-
JAVA_VERSION=$("$JAVA_HOME/bin/java" -version 2>&1 | head -1 | cut -d'"' -f2 | cut -d'.' -f1)
8+
# Filter out JAVA_TOOL_OPTIONS message and get version from "openjdk version" or "java version" line
9+
JAVA_VERSION=$("$JAVA_HOME/bin/java" -version 2>&1 | grep -E '(openjdk|java) version' | head -1 | cut -d'"' -f2 | cut -d'.' -f1)
910
if [ "$JAVA_VERSION" -ge 21 ] 2>/dev/null; then
1011
echo "$JAVA_HOME/bin/java"
1112
return 0

scripts/setup-mcp-sonarqube.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ echo "Setting up SonarQube MCP Server for Claude Code..."
1414
# Check for Java 21+
1515
check_java() {
1616
if command -v java &> /dev/null; then
17-
JAVA_VERSION=$(java -version 2>&1 | head -1 | cut -d'"' -f2 | cut -d'.' -f1)
17+
# Filter out JAVA_TOOL_OPTIONS message and get version from "openjdk version" or "java version" line
18+
JAVA_VERSION=$(java -version 2>&1 | grep -E '(openjdk|java) version' | head -1 | cut -d'"' -f2 | cut -d'.' -f1)
1819
if [ "$JAVA_VERSION" -ge "$REQUIRED_JAVA_VERSION" ] 2>/dev/null; then
1920
echo "Found Java $JAVA_VERSION"
2021
return 0
@@ -23,7 +24,8 @@ check_java() {
2324

2425
# Check for JAVA_HOME with JDK 21+
2526
if [ -n "$JAVA_HOME" ]; then
26-
JAVA_VERSION=$("$JAVA_HOME/bin/java" -version 2>&1 | head -1 | cut -d'"' -f2 | cut -d'.' -f1)
27+
# Filter out JAVA_TOOL_OPTIONS message and get version from "openjdk version" or "java version" line
28+
JAVA_VERSION=$("$JAVA_HOME/bin/java" -version 2>&1 | grep -E '(openjdk|java) version' | head -1 | cut -d'"' -f2 | cut -d'.' -f1)
2729
if [ "$JAVA_VERSION" -ge "$REQUIRED_JAVA_VERSION" ] 2>/dev/null; then
2830
echo "Found Java $JAVA_VERSION at JAVA_HOME"
2931
return 0

0 commit comments

Comments
 (0)