openclaw - ✅(Solved) Fix [Feature]: Add --daemon-env flag to openclaw node install [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#68297Fetched 2026-04-18 05:53:15
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Participants
Timeline (top)
cross-referenced ×1referenced ×1

Add a repeatable --daemon-env KEY=VALUE flag to openclaw node install so that extra Environment= lines can be injected into the generated systemd/launchd unit at install time — matching the flag already added to openclaw onboard --install-daemon in #68240.

Root Cause

Add a repeatable --daemon-env KEY=VALUE flag to openclaw node install so that extra Environment= lines can be injected into the generated systemd/launchd unit at install time — matching the flag already added to openclaw onboard --install-daemon in #68240.

Fix Action

Fix / Workaround

The same problem that motivated #68240 exists on the node side. When the gateway is LAN-bound (docker, headscale, VPC), the node service must run with OPENCLAW_ALLOW_INSECURE_PRIVATE_WS=1 to connect. Currently there is no way to inject this at install time, so the workaround requires:

FileChange
src/cli/node-cli/register.tsAdd repeatable --daemon-env <KEY=VALUE> option to the install subcommand
src/cli/node-cli/daemon.tsParse --daemon-env entries and merge into environment before service.install()

PR fix notes

PR #68301: feat(node): add --daemon-env flag to openclaw node install

Description (problem / solution / changelog)

Fixes #68297 Related: #68240

What

Mirrors the --daemon-env flag added to openclaw onboard --install-daemon in #68240, now for openclaw node install.

openclaw node install --host <gw> --port 18789 \
  --daemon-env OPENCLAW_ALLOW_INSECURE_PRIVATE_WS=1

Why

When the gateway is LAN-bound (docker, headscale, VPC), the node service must run with OPENCLAW_ALLOW_INSECURE_PRIVATE_WS=1. Without this flag, the only workaround is to write a systemd drop-in after install and restart the service — adding an unnecessary restart cycle.

How

Same pattern as #68240:

  • Add repeatable --daemon-env <KEY=VALUE> option to src/cli/node-cli/register.ts
  • Parse entries via parseDaemonEnvEntries() (reused from daemon-install-helpers.ts, no new code)
  • Merge into the environment dict before service.install() in src/cli/node-cli/daemon.ts

Files changed

FileChange
src/cli/node-cli/register.tsAdd repeatable --daemon-env option to install subcommand
src/cli/node-cli/daemon.tsAdd daemonEnv to options type + merge into environment before install

Changed files

  • src/cli/node-cli/daemon.ts (modified, +16/-1)
  • src/cli/node-cli/register.ts (modified, +1/-0)
  • src/commands/daemon-install-helpers.ts (modified, +29/-0)

Code Example

openclaw node install --host <gw> --port 18789 \
  --daemon-env OPENCLAW_ALLOW_INSECURE_PRIVATE_WS=1
RAW_BUFFERClick to expand / collapse

Summary

Add a repeatable --daemon-env KEY=VALUE flag to openclaw node install so that extra Environment= lines can be injected into the generated systemd/launchd unit at install time — matching the flag already added to openclaw onboard --install-daemon in #68240.

Motivation

The same problem that motivated #68240 exists on the node side. When the gateway is LAN-bound (docker, headscale, VPC), the node service must run with OPENCLAW_ALLOW_INSECURE_PRIVATE_WS=1 to connect. Currently there is no way to inject this at install time, so the workaround requires:

  1. openclaw node install ...
  2. Write a systemd drop-in (~/.config/systemd/user/openclaw-node.service.d/env.conf) with Environment=OPENCLAW_ALLOW_INSECURE_PRIVATE_WS=1
  3. Restart the service

This forces an extra restart cycle after every fresh node install in LAN-bind mode — the first start runs without the env var, causing the node to fail to connect to the gateway.

Proposed solution

openclaw node install --host <gw> --port 18789 \
  --daemon-env OPENCLAW_ALLOW_INSECURE_PRIVATE_WS=1

The plumbing is straightforward — buildNodeInstallPlan already returns an environment dict that flows into service.install(). The parseDaemonEnvEntries helper introduced in #68240 already lives in daemon-install-helpers.ts (imported by both the gateway and node paths) and can be reused directly.

Files to change

FileChange
src/cli/node-cli/register.tsAdd repeatable --daemon-env <KEY=VALUE> option to the install subcommand
src/cli/node-cli/daemon.tsParse --daemon-env entries and merge into environment before service.install()

No changes needed to parseDaemonEnvEntries or buildNodeInstallPlan — the hook point already exists.

extent analysis

TL;DR

Add a --daemon-env flag to openclaw node install to inject environment variables into the generated systemd/launchd unit.

Guidance

  • Modify src/cli/node-cli/register.ts to add a repeatable --daemon-env <KEY=VALUE> option to the install subcommand.
  • Update src/cli/node-cli/daemon.ts to parse --daemon-env entries and merge them into the environment dictionary before calling service.install().
  • Reuse the existing parseDaemonEnvEntries helper function from daemon-install-helpers.ts to parse the --daemon-env entries.
  • Verify the fix by running openclaw node install with the new --daemon-env flag and checking the generated systemd/launchd unit for the injected environment variables.

Example

openclaw node install --host <gw> --port 18789 \
  --daemon-env OPENCLAW_ALLOW_INSECURE_PRIVATE_WS=1

Notes

This solution assumes that the parseDaemonEnvEntries helper function is correctly implemented and works as expected. Additionally, this fix only addresses the specific use case of injecting environment variables into the systemd/launchd unit and may not cover other potential issues.

Recommendation

Apply the proposed solution by modifying the register.ts and daemon.ts files to add support for the --daemon-env flag, as this will provide a straightforward and efficient way to inject environment variables into the generated systemd/launchd unit.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - ✅(Solved) Fix [Feature]: Add --daemon-env flag to openclaw node install [1 pull requests, 1 participants]