Skip to content

Conversation

@rianjs
Copy link
Collaborator

@rianjs rianjs commented Jan 25, 2026

Summary

  • Add ATLASSIAN_URL, ATLASSIAN_EMAIL, ATLASSIAN_API_TOKEN env var fallbacks
  • Enables shared credentials between cfl (Confluence) and jtk (Jira) CLIs
  • Tool-specific vars (CFL_*) take precedence over shared vars (ATLASSIAN_*)

Precedence Order

Setting Lookup Order
URL CFL_URLATLASSIAN_URL → config
Email CFL_EMAILATLASSIAN_EMAIL → config
Token CFL_API_TOKENATLASSIAN_API_TOKEN → config

Usage

Shared credentials (both tools):

export ATLASSIAN_URL=https://mycompany.atlassian.net
export ATLASSIAN_EMAIL=user@example.com
export ATLASSIAN_API_TOKEN=your-token

Per-tool override:

export ATLASSIAN_EMAIL=user@example.com
export ATLASSIAN_API_TOKEN=your-token
export CFL_URL=https://confluence.internal.corp.com  # Different URL for Confluence only

Changes

  • internal/config/config.go: Add getEnvWithFallback() helper, update LoadFromEnv()
  • internal/config/config_test.go: Add tests for fallback behavior and precedence
  • README.md, CLAUDE.md: Document new env vars

Test Plan

  • Build passes
  • All tests pass (including new ATLASSIAN_* tests)
  • Lint passes

Closes #99

Add support for shared ATLASSIAN_* environment variables that work
across both cfl (Confluence) and jtk (Jira) CLIs.

Precedence order (first match wins):
- URL: CFL_URL → ATLASSIAN_URL → config
- Email: CFL_EMAIL → ATLASSIAN_EMAIL → config
- Token: CFL_API_TOKEN → ATLASSIAN_API_TOKEN → config

This allows users to set credentials once for both tools:
  export ATLASSIAN_URL=https://mycompany.atlassian.net
  export ATLASSIAN_EMAIL=user@example.com
  export ATLASSIAN_API_TOKEN=token

While still allowing per-tool overrides when needed.

Closes #99
@rianjs
Copy link
Collaborator Author

rianjs commented Jan 25, 2026

Test Coverage Assessment

Summary

The test coverage for this PR is excellent. The new functionality is well-tested with appropriate coverage of all critical paths.

What's Tested

getEnvWithFallback helper function:

  • Returns primary value when set
  • Falls back when primary is empty
  • Returns empty when both are empty

LoadFromEnv with ATLASSIAN_ fallbacks:*

  • ATLASSIAN_* vars used when CFL_* not set (URL, email, token)
  • CFL_* takes precedence when both are set
  • Mixed usage (e.g., CFL_URL with ATLASSIAN_EMAIL/TOKEN)

Assessment

Aspect Status Notes
Core logic tested Covered All three fallback scenarios covered
Edge cases Covered Empty vars, mixed vars, precedence
Integration with existing tests Good Existing TestConfig_LoadFromEnv tests still pass and complement new tests

No Gaps Identified

The PR adds:

  1. A simple 5-line helper function (getEnvWithFallback)
  2. Updates to LoadFromEnv to use the helper for 3 config fields

Both are fully covered by the new tests. The test structure follows existing patterns in the codebase and properly cleans up environment variables.

Verdict: No additional test coverage needed. The tests verify the documented behavior (precedence order) and cover the realistic use cases described in the PR.

@rianjs rianjs merged commit 873c329 into main Jan 25, 2026
3 checks passed
@rianjs rianjs deleted the feat/99-atlassian-env-fallbacks branch January 25, 2026 21:31
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.

Add ATLASSIAN_* env var fallbacks for shared credentials

2 participants