Skip to content

feat(cli): support HAPI_HOSTNAME env to override machine hostname#94

Merged
tiann merged 1 commit intotiann:mainfrom
instartlove:feat/custom-hostname
Jan 21, 2026
Merged

feat(cli): support HAPI_HOSTNAME env to override machine hostname#94
tiann merged 1 commit intotiann:mainfrom
instartlove:feat/custom-hostname

Conversation

@instartlove
Copy link
Contributor

Summary

Allow users without root privileges to customize machine hostname via environment variable HAPI_HOSTNAME.

Changes

  • cli/src/agent/sessionFactory.ts: Add process.env.HAPI_HOSTNAME fallback in buildMachineMetadata()

Usage

HAPI_HOSTNAME="my-server" hapi runner start

Motivation

On systems where users don't have root access, changing the OS hostname requires elevated privileges. This PR provides a simple workaround by allowing the hostname to be overridden via environment variable.

return {
host: os.hostname(),
host: process.env.HAPI_HOSTNAME || os.hostname(),
platform: os.platform(),

Choose a reason for hiding this comment

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

[NIT] [DOCS] HAPI_HOSTNAME not documented in CLI env list

Why this is a problem: Users won't discover the new override because cli/README.md enumerates env vars and doesn't mention HAPI_HOSTNAME.

Suggested fix:

- `HAPI_HOSTNAME` - Override hostname reported to the server (default: OS hostname).

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Findings

  • [NIT] HAPI_HOSTNAME not documented in CLI env list — users won’t discover the override, evidence cli/src/agent/sessionFactory.ts:38
    Suggested fix:
    - `HAPI_HOSTNAME` - Override hostname reported to the server (default: OS hostname).

Summary

  • Doc update needed for new env var; no other diff issues found.

Testing

  • Not run (automation)

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Findings

  • [Nit] HAPI_HOSTNAME not documented in CLI env list — users won’t discover the override, evidence cli/src/agent/sessionFactory.ts:38
    Suggested fix:
    - `HAPI_HOSTNAME` - Override hostname reported to the server (default: OS hostname).

Summary

  • Doc update needed for new env var; no other diff issues found.

Testing

  • Not run (automation)

HAPI Bot

@tiann
Copy link
Owner

tiann commented Jan 21, 2026

@tiann Modify this pr and update the documentation

github-actions bot pushed a commit that referenced this pull request Jan 21, 2026
@github-actions
Copy link

Change: add HAPI_HOSTNAME override in CLI machine metadata (cli/src/agent/sessionFactory.ts:38); docs update in cli/README.md:76 and docs/guide/installation.md:96.

Tests: bun typecheck failed (bun not found in runner).

PR Created: #95


HAPI Bot

@tiann tiann merged commit 8b36802 into tiann:main Jan 21, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants