Skip to content

Commit a6d3a5b

Browse files
committed
changed diagnostics to use opensearch host and port
1 parent ed273ad commit a6d3a5b

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/tui/screens/diagnostics.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -397,12 +397,17 @@ async def check_opensearch_security(self) -> None:
397397
log.write("")
398398
return
399399

400+
# Get OpenSearch host and port from environment
401+
opensearch_host = os.getenv("OPENSEARCH_HOST", "localhost")
402+
opensearch_port = os.getenv("OPENSEARCH_PORT", "9200")
403+
opensearch_url = f"https://{opensearch_host}:{opensearch_port}"
404+
400405
# Test basic authentication
401406
log.write("Testing basic authentication...")
402407
cmd = [
403408
"curl", "-s", "-k", "-w", "%{http_code}",
404409
"-u", f"admin:{opensearch_password}",
405-
"https://localhost:9200"
410+
opensearch_url
406411
]
407412
process = await asyncio.create_subprocess_exec(
408413
*cmd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE
@@ -436,7 +441,7 @@ async def check_opensearch_security(self) -> None:
436441
cmd = [
437442
"curl", "-s", "-k", "-w", "%{http_code}",
438443
"-u", f"admin:{opensearch_password}",
439-
"https://localhost:9200/_plugins/_security/api/account"
444+
f"{opensearch_url}/_plugins/_security/api/account"
440445
]
441446
process = await asyncio.create_subprocess_exec(
442447
*cmd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE
@@ -472,7 +477,7 @@ async def check_opensearch_security(self) -> None:
472477
cmd = [
473478
"curl", "-s", "-k", "-w", "%{http_code}",
474479
"-u", f"admin:{opensearch_password}",
475-
"https://localhost:9200/_plugins/_security/api/internalusers"
480+
f"{opensearch_url}/_plugins/_security/api/internalusers"
476481
]
477482
process = await asyncio.create_subprocess_exec(
478483
*cmd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE
@@ -506,7 +511,7 @@ async def check_opensearch_security(self) -> None:
506511
cmd = [
507512
"curl", "-s", "-k", "-w", "%{http_code}",
508513
"-u", f"admin:{opensearch_password}",
509-
"https://localhost:9200/_plugins/_security/api/securityconfig"
514+
f"{opensearch_url}/_plugins/_security/api/securityconfig"
510515
]
511516
process = await asyncio.create_subprocess_exec(
512517
*cmd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE
@@ -554,7 +559,7 @@ async def check_opensearch_security(self) -> None:
554559
cmd = [
555560
"curl", "-s", "-k", "-w", "%{http_code}",
556561
"-u", f"admin:{opensearch_password}",
557-
"https://localhost:9200/_cat/indices?v"
562+
f"{opensearch_url}/_cat/indices?v"
558563
]
559564
process = await asyncio.create_subprocess_exec(
560565
*cmd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE

0 commit comments

Comments
 (0)