Skip to content

Use profile isAPNSProduction as source of truth for Loop APNs environment - #8547

Open
bjorkert wants to merge 3 commits into
nightscout:devfrom
bjorkert:loop-apns-production-from-profile
Open

Use profile isAPNSProduction as source of truth for Loop APNs environment#8547
bjorkert wants to merge 3 commits into
nightscout:devfrom
bjorkert:loop-apns-production-from-profile

Conversation

@bjorkert

Copy link
Copy Markdown
Member

Summary

When sending Loop remote-command push notifications, the APNs environment (production vs. sandbox) is currently determined solely by the LOOP_PUSH_SERVER_ENVIRONMENT environment variable. This means the environment has to be configured manually on the Nightscout site and can drift out of sync with how the Loop app itself is actually built.

Loop is about to start writing an isAPNSProduction boolean to the uploaded profile (see LoopKit/NightscoutKit#1). This is an optional, top-level profile field that is only serialized when set. This PR makes that field the source of truth when present, and keeps LOOP_PUSH_SERVER_ENVIRONMENT as the fallback.

Behavior

  • If the profile contains isAPNSProduction, it is used directly (true → production, false → sandbox).
  • If the field is absent, behavior is unchanged: fall back to LOOP_PUSH_SERVER_ENVIRONMENT === "production".

The !== undefined check (rather than a truthy fallback) is deliberate so that an explicit isAPNSProduction: false correctly forces the sandbox environment even when the env var says production.

Compatibility

Fully backward compatible. Existing deployments where Loop does not yet write the field, or that don't run Loop, behave exactly as before.

Related

bjorkert and others added 3 commits June 26, 2026 20:27
…ment

The APNs environment for Loop remote-command push notifications was
determined solely by the LOOP_PUSH_SERVER_ENVIRONMENT environment
variable, which has to be configured manually and can drift out of sync
with how the Loop app is built.

Use the optional top-level isAPNSProduction profile field as the source
of truth when present, falling back to LOOP_PUSH_SERVER_ENVIRONMENT
otherwise. The explicit undefined check ensures isAPNSProduction: false
forces the sandbox environment even when the env var says production.
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.

2 participants