Skip to content

fix(config): thread API_BASE_URL through core/network as single source (E01.S05)#7

Open
abdout wants to merge 1 commit into
mainfrom
feat/E01-S05-buildconfig-helper-drift
Open

fix(config): thread API_BASE_URL through core/network as single source (E01.S05)#7
abdout wants to merge 1 commit into
mainfrom
feat/E01-S05-buildconfig-helper-drift

Conversation

@abdout
Copy link
Copy Markdown
Contributor

@abdout abdout commented May 25, 2026

Summary

  • Moves the canonical API base URL to core/network/BuildConfig.API_BASE_URL; removes 4 hardcoded URLs from 3 different files
  • network-module.kt:provideRetrofit and BuildConfigHelper.apiBaseUrl both read through to the same constant
  • Adds inline comments documenting the trailing-slash + no-/api/ URL convention (endpoint paths carry api/... themselves)

Story

E01.S05 (Phase 1 Pilot v1, Sprint P1, 2 pts).

Test plan

  • ./gradlew :core:network:assembleDebug succeeds (validates buildFeatures { buildConfig = true } works with the new buildConfigField)
  • ./gradlew :app:assembleDebug succeeds (validates the BuildConfigHelper cross-module import resolves)
  • One grep -rE 'buildConfigField.*API_BASE_URL' hit in the repo: core/network/build.gradle.kts only
  • One grep -rE '\"https://[^\"]*databayt\\.org/?[^\"]*\"' hit in production code: core/network/build.gradle.kts (+ app/build.gradle.kts SOCKET_URL until E09)

Deferred

  • AC4 (CI lint rule against hardcoded databayt.org URLs outside app/build.gradle.kts) — folds into E01.S09 with the rest of the custom Detekt rules

Closes #6

Generated with Claude Code

…e (E01.S05)

Three places used to hold a different API host string:

- `core/network/.../network-module.kt:26` — production host
  `https://ed.databayt.org/`, used by Retrofit
- `app/build.gradle.kts` — `BuildConfig.API_BASE_URL =
  "https://ed.databayt.org/api/"` (would double-prefix `/api/` since
  endpoints already start with `api/mobile/...`)
- `app/.../config/build-config-helper.kt` — hardcoded
  `staging-api.databayt.org` / `api.databayt.org` subdomains that don't
  match production

Drift was silent because `BuildConfigHelper.apiBaseUrl` had no callers.

Moves the canonical URL to `core/network/BuildConfig.API_BASE_URL` (the
module owns the config). `network-module.kt:provideRetrofit` reads it
directly; `BuildConfigHelper.apiBaseUrl` reads through to the same
constant via `import ... core.network.BuildConfig`. Drops the wrong
`API_BASE_URL` definitions from `app/build.gradle.kts` (defaultConfig +
both buildTypes); `SOCKET_URL` stays until E09 lifts it.

Adds inline comments documenting the URL convention (trailing slash,
no `/api/` because endpoint paths carry that prefix themselves).

Deferred: AC4 (CI lint rule against hardcoded `databayt.org` URLs)
folds into E01.S09 with the rest of the custom Detekt rules.

Closes #6

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

fix(config): single source of truth for API base URL (E01.S05)

1 participant