fix(gateway): separate Forgejo token env #61

Merged
jwilger merged 2 commits from fix/gateway-forgejo-token-env into main 2026-05-03 15:12:07 -07:00
Owner

Summary

  • Make ar-gateway read the bot PAT from AR_FORGEJO_TOKEN instead of FORGEJO_TOKEN.
  • Update quickstart, deploy examples, Helm secret wiring, and threat-model docs for the gateway-specific token name.
  • Keep FORGEJO_TOKEN available for developer-local Forgejo tooling such as Kilo MCP/tea.

Validation

  • nix develop -c cargo test -p ar-gateway forgejo_api_token
  • nix develop -c cargo fmt --all -- --check
  • nix develop -c cargo clippy -p ar-gateway --all-targets -- -D warnings
## Summary - Make `ar-gateway` read the bot PAT from `AR_FORGEJO_TOKEN` instead of `FORGEJO_TOKEN`. - Update quickstart, deploy examples, Helm secret wiring, and threat-model docs for the gateway-specific token name. - Keep `FORGEJO_TOKEN` available for developer-local Forgejo tooling such as Kilo MCP/tea. ## Validation - `nix develop -c cargo test -p ar-gateway forgejo_api_token` - `nix develop -c cargo fmt --all -- --check` - `nix develop -c cargo clippy -p ar-gateway --all-targets -- -D warnings`
fix(gateway): separate Forgejo token env
Some checks failed
auto_review auto_review: 1 warning
CI / Nix flake check (pull_request) Has been cancelled
f6a0e1b3c2
auto-review left a comment

This PR updates the ar-gateway to read the Forgejo API token from AR_FORGEJO_TOKEN instead of FORGEJO_TOKEN, allowing the latter to be used for developer-local tooling. The changes include updates to documentation, configuration files, and the main gateway code. The changes appear well-implemented and safe to merge.

Walkthrough

  • CHANGELOG.md: Updated to reflect the change in environment variable for the Forgejo token.
  • QUICKSTART.md: Instructions updated to use AR_FORGEJO_TOKEN for the gateway, while FORGEJO_TOKEN remains for developer use.
  • crates/ar-gateway/src/main.rs: Main logic updated to use AR_FORGEJO_TOKEN. Added a helper function forgejo_api_token_from_env_values to handle token retrieval.
  • deploy/docker-compose.yml: Environment variable updated to AR_FORGEJO_TOKEN.
  • deploy/helm/README.md and deploy/helm/templates/secret.yaml: Helm deployment instructions and templates updated to use the new token environment variable.
  • deploy/systemd/auto_review.env.example: Example environment file updated to reflect the new token variable.
  • docs/THREAT-MODEL.md: Documentation updated to reflect the change in token environment variable.

Pre-merge checks

  • CHANGELOG updated — CHANGELOG.md is in the diff
  • Tests touched — source changed but no test file appears in the diff
  • No new TODO/FIXME comments — no new TODO/FIXME markers
This PR updates the `ar-gateway` to read the Forgejo API token from `AR_FORGEJO_TOKEN` instead of `FORGEJO_TOKEN`, allowing the latter to be used for developer-local tooling. The changes include updates to documentation, configuration files, and the main gateway code. The changes appear well-implemented and safe to merge. ## Walkthrough - **CHANGELOG.md**: Updated to reflect the change in environment variable for the Forgejo token. - **QUICKSTART.md**: Instructions updated to use `AR_FORGEJO_TOKEN` for the gateway, while `FORGEJO_TOKEN` remains for developer use. - **crates/ar-gateway/src/main.rs**: Main logic updated to use `AR_FORGEJO_TOKEN`. Added a helper function `forgejo_api_token_from_env_values` to handle token retrieval. - **deploy/docker-compose.yml**: Environment variable updated to `AR_FORGEJO_TOKEN`. - **deploy/helm/README.md** and **deploy/helm/templates/secret.yaml**: Helm deployment instructions and templates updated to use the new token environment variable. - **deploy/systemd/auto_review.env.example**: Example environment file updated to reflect the new token variable. - **docs/THREAT-MODEL.md**: Documentation updated to reflect the change in token environment variable. ## Pre-merge checks - [x] CHANGELOG updated — CHANGELOG.md is in the diff - [ ] Tests touched — source changed but no test file appears in the diff - [x] No new TODO/FIXME comments — no new TODO/FIXME markers
@ -77,7 +77,7 @@ async fn main() -> Result<()> {
);
Owner

🟡 Warning: Ensure that the forgejo_api_token_from_env_values function correctly handles cases where AR_FORGEJO_TOKEN is not set, as this could lead to runtime errors if not properly managed.

🟡 **Warning:** Ensure that the `forgejo_api_token_from_env_values` function correctly handles cases where `AR_FORGEJO_TOKEN` is not set, as this could lead to runtime errors if not properly managed.
Author
Owner

Addressed by adding crates/ar-gateway/tests/gateway_env.rs, an integration test that starts the gateway binary with WEBHOOK_SECRET and FORGEJO_BASE_URL set but AR_FORGEJO_TOKEN/FORGEJO_TOKEN removed. It asserts startup fails and the error names AR_FORGEJO_TOKEN, so the missing-token case is now covered in a dedicated test file.

Addressed by adding `crates/ar-gateway/tests/gateway_env.rs`, an integration test that starts the gateway binary with `WEBHOOK_SECRET` and `FORGEJO_BASE_URL` set but `AR_FORGEJO_TOKEN`/`FORGEJO_TOKEN` removed. It asserts startup fails and the error names `AR_FORGEJO_TOKEN`, so the missing-token case is now covered in a dedicated test file.
jwilger marked this conversation as resolved
test(gateway): cover missing Forgejo token env
All checks were successful
auto_review auto_review: 1 warning
CI / Nix flake check (pull_request) Successful in 1m54s
8de8cd7f1b
auto-review left a comment

This PR updates the ar-gateway to use AR_FORGEJO_TOKEN for the Forgejo API token, separating it from FORGEJO_TOKEN used for local tooling. The changes include updates to documentation, configuration files, and tests to reflect this new environment variable. The changes appear well-implemented and safe to merge.

Walkthrough

  • CHANGELOG.md: Updated to reflect the change in environment variable for the gateway's Forgejo token.
  • QUICKSTART.md: Instructions updated to use AR_FORGEJO_TOKEN instead of FORGEJO_TOKEN for the gateway.
  • crates/ar-gateway/src/main.rs: Main logic updated to read the Forgejo token from AR_FORGEJO_TOKEN.
  • crates/ar-gateway/tests/gateway_env.rs: New test added to ensure the gateway requires AR_FORGEJO_TOKEN to start.
  • deploy/docker-compose.yml: Environment variable updated to AR_FORGEJO_TOKEN.
  • deploy/helm/README.md: Helm deployment instructions updated to use AR_FORGEJO_TOKEN.
  • deploy/helm/templates/secret.yaml: Secret template updated to use AR_FORGEJO_TOKEN.
  • deploy/systemd/auto_review.env.example: Example environment file updated to use AR_FORGEJO_TOKEN.
  • docs/THREAT-MODEL.md: Documentation updated to reflect the change in token environment variable.

Pre-merge checks

  • CHANGELOG updated — CHANGELOG.md is in the diff
  • Tests touched — test changes are in the diff
  • No new TODO/FIXME comments — no new TODO/FIXME markers
This PR updates the `ar-gateway` to use `AR_FORGEJO_TOKEN` for the Forgejo API token, separating it from `FORGEJO_TOKEN` used for local tooling. The changes include updates to documentation, configuration files, and tests to reflect this new environment variable. The changes appear well-implemented and safe to merge. ## Walkthrough - **CHANGELOG.md**: Updated to reflect the change in environment variable for the gateway's Forgejo token. - **QUICKSTART.md**: Instructions updated to use `AR_FORGEJO_TOKEN` instead of `FORGEJO_TOKEN` for the gateway. - **crates/ar-gateway/src/main.rs**: Main logic updated to read the Forgejo token from `AR_FORGEJO_TOKEN`. - **crates/ar-gateway/tests/gateway_env.rs**: New test added to ensure the gateway requires `AR_FORGEJO_TOKEN` to start. - **deploy/docker-compose.yml**: Environment variable updated to `AR_FORGEJO_TOKEN`. - **deploy/helm/README.md**: Helm deployment instructions updated to use `AR_FORGEJO_TOKEN`. - **deploy/helm/templates/secret.yaml**: Secret template updated to use `AR_FORGEJO_TOKEN`. - **deploy/systemd/auto_review.env.example**: Example environment file updated to use `AR_FORGEJO_TOKEN`. - **docs/THREAT-MODEL.md**: Documentation updated to reflect the change in token environment variable. ## Pre-merge checks - [x] CHANGELOG updated — CHANGELOG.md is in the diff - [x] Tests touched — test changes are in the diff - [x] No new TODO/FIXME comments — no new TODO/FIXME markers
Owner

🟡 Warning: Ensure that the forgejo_api_token_from_env_values function correctly handles cases where AR_FORGEJO_TOKEN is not set, as this is a critical change in how the token is retrieved.

🟡 **Warning:** Ensure that the `forgejo_api_token_from_env_values` function correctly handles cases where `AR_FORGEJO_TOKEN` is not set, as this is a critical change in how the token is retrieved.
jwilger deleted branch fix/gateway-forgejo-token-env 2026-05-03 15:12:07 -07:00
jwilger referenced this pull request from a commit 2026-05-05 12:18:07 -07:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Slipstream/auto_review!61
No description provided.