Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions config/openclaw/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ let
if host.isKyber then
{
chromium = "${pkgs.chromium}";
kubectl = "${pkgs.kubectl}/bin/kubectl";
}
else
{
chromium = "/unused";
kubectl = "/usr/bin/true";
}
);
names = builtins.attrNames vars;
Expand Down
2 changes: 1 addition & 1 deletion config/openclaw/hydrate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ if [ "$MODE" = "gateway" ]; then
CHROMIUM_PATH="@chromium@/bin/chromium"

# Resolve Alloy OTLP ClusterIP for local telemetry export
OTEL_ENDPOINT="http://$(kubectl get svc alloy -n alloy -o jsonpath='{.spec.clusterIP}' 2>/dev/null || echo localhost):4318"
OTEL_ENDPOINT="http://$(@kubectl@ get svc alloy -n alloy -o jsonpath='{.spec.clusterIP}' 2>/dev/null || echo localhost):4318"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The fallback logic for OTEL_ENDPOINT does not work as intended when @kubectl@ is substituted with /usr/bin/true (which occurs on non-Kyber hosts). Since true exits with code 0 but produces no output, the command substitution $(...) returns an empty string, resulting in an invalid endpoint URL: http://:4318.

Using shell parameter expansion ${VAR:-default} ensures that the fallback to localhost works correctly even when the command succeeds with empty output.

Suggested change
OTEL_ENDPOINT="http://$(@kubectl@ get svc alloy -n alloy -o jsonpath='{.spec.clusterIP}' 2>/dev/null || echo localhost):4318"
OTEL_ENDPOINT=$(@kubectl@ get svc alloy -n alloy -o jsonpath='{.spec.clusterIP}' 2>/dev/null || echo localhost)
OTEL_ENDPOINT="http://${OTEL_ENDPOINT:-localhost}:4318"
References
  1. Maintain consistency with established patterns for writing scripts that are extracted from Nix expressions, ensuring placeholders like @kubectl@ are handled correctly even when substituted with no-op commands.


@sed@ \
-e "s|__CLIPROXY_API_KEY__|${CLIPROXY_API_KEY}|g" \
Expand Down
Loading