Skip to content

fix(cli): honour EVERME_API_BASE for self-hosted endpoints - #27

Open
Lumea-art wants to merge 1 commit into
EverMind-AI:mainfrom
Lumea-art:fix/honor-everme-api-base
Open

Lumea-art wants to merge 1 commit into
EverMind-AI:mainfrom
Lumea-art:fix/honor-everme-api-base

Conversation

@Lumea-art

Copy link
Copy Markdown

Summary

Both READMEs tell self-hosters to set EVERME_API_BASE before evercli auth login, and every host integration writes that same variable into its MCP entry — but core.LoadConfig only ever looked at EVERCLI_*, because viper's AutomaticEnv with SetEnvPrefix("EVERCLI") cannot see an EVERME_-prefixed name. The documented override was therefore silently ignored and the CLI always talked to the managed gateway.

Changes

  • cli/internal/core/config.go — bind api_base_url explicitly to EVERCLI_API_BASE_URL and EVERME_API_BASE (first name wins) instead of relying on AutomaticEnv alone.
  • cli/internal/core/config_test.go — three regression tests: EVERME_API_BASE overrides the compiled-in default, EVERCLI_API_BASE_URL keeps precedence, and env still beats the config file.

Precedence for existing users is unchanged: EVERCLI_API_BASE_URL > EVERME_API_BASE > config.yaml > compiled-in default, which matches the priority list documented on Config.

Self-hosters who configured the plugin by hand benefit as well: plugin install copies the resolved api_base_url into the host MCP entry as EVERME_API_BASE, so the same variable now flows from the CLI into every host integration.

Test Plan

go1.27.4, linux/amd64, commit 1cfd5bf:

go test ./... -count=1     ok    (all packages)
go vet ./...               exit 0
gofmt -l .                 (no output)
go mod tidy                (no change to go.mod / go.sum)

Manual verification — the documented flow now reaches the configured endpoint instead of production:

# before
$ EVERME_API_BASE=http://127.0.0.1:1 evercli doctor
  network.everme-api  ok=true   reachable        # variable ignored, hit the managed gateway

# after
$ EVERME_API_BASE=http://127.0.0.1:1 evercli doctor
  network.everme-api  ok=false  unreachable: Get "http://127.0.0.1:1/healthz": dial tcp 127.0.0.1:1: connect: connection refused
  • CLI tests pass, if cli/ changed
  • Plugin workspace tests pass, if plugins/ changed — not applicable, this PR does not touch plugins/
  • Manual verification completed, if behavior changed

Security

  • No real emk_*, evt_*, cookies, private URLs, or production logs are included — tests use https://selfhosted.example.com and 127.0.0.1 only.

Related Issues

Both READMEs tell self-hosters to set EVERME_API_BASE before 'evercli auth login', and
every host integration writes that same variable into its MCP entry — but core.LoadConfig
only ever looked at EVERCLI_*, so the documented override was silently ignored and the CLI
kept talking to the managed gateway (issue EverMind-AI#3).

Bind api_base_url explicitly: EVERCLI_API_BASE_URL stays the (undocumented) escape hatch
and keeps precedence, EVERME_API_BASE now satisfies the documented contract, and env still
beats the config file as the priority list promises.
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.

1 participant