Skip to content

Use a single shared root .env for iOS and Android config#90

Draft
Brian Plattenburg (bplattenburg) wants to merge 1 commit into
bp/sdk-v5-migrationfrom
bp/shared-root-env
Draft

Use a single shared root .env for iOS and Android config#90
Brian Plattenburg (bplattenburg) wants to merge 1 commit into
bp/sdk-v5-migrationfrom
bp/shared-root-env

Conversation

@bplattenburg

Copy link
Copy Markdown
Member

Replaces the two separate config files (iOS/.env + Android local.properties entries) with one shared repo-root .env as the single source of truth for DITTO_DATABASE_ID / DITTO_DEVELOPMENT_TOKEN / DITTO_URL. Stacked on #89.

Changes

  • Root .env.template (moved up from iOS/); values are unquoted.
  • iOS: the Generate Env.swift build phase now reads ${SRCROOT}/../.env (the repo root).
  • Android: app/build.gradle.kts reads the repo-root .env via a new dittoEnv() helper and wraps each value for buildConfigField. local.properties now holds only the SDK location.
  • READMEs: both updated to the shared-.env flow (also fixes stale v4 key names in iOS/README.md).

Why unquoted values

iOS's buildEnv.sh wraps values in quotes when generating Env.swift, while Android's buildConfigField needs a quoted code literal. The shared .env keeps values unquoted; each platform adds its own quoting.

Migration for devs

Copy .env.template.env at the repo root and fill in the three values. Remove the Ditto keys from Android/local.properties (keep sdk.dir); delete the old iOS/.env.

cc Aaron LaBeau (@biozal) Walker Erekson (@texasRanger09) @getditto/commercial-solutions

Both apps read DITTO_DATABASE_ID / DITTO_DEVELOPMENT_TOKEN / DITTO_URL from
one repo-root .env instead of separate iOS/.env and Android local.properties
entries.

- Add root .env.template (unquoted values); move it up from iOS/.
- iOS: "Generate Env.swift" build phase reads ${SRCROOT}/../.env.
- Android: read the repo-root .env via dittoEnv() and wrap values for
  BuildConfig; local.properties keeps only the SDK location.
- Update iOS/Android READMEs to the shared-.env setup flow.
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