Skip to content

feat(mipush): handle missing key by environment mode & update README run instructions#16

Merged
w568w merged 2 commits intoOpenTreeHole:mainfrom
Acture:feat/mipush-env-handling
Nov 1, 2025
Merged

feat(mipush): handle missing key by environment mode & update README run instructions#16
w568w merged 2 commits intoOpenTreeHole:mainfrom
Acture:feat/mipush-env-handling

Conversation

@Acture
Copy link
Copy Markdown
Contributor

@Acture Acture commented Oct 31, 2025

🧩 Summary

This PR introduces environment-aware behavior for the Mipush key initialization
and updates the documentation to reflect the new MODE settings.

  • Code changes

    • mipush/init.go
    • Refactored getMipushKey() to handle missing keys differently across modes:
      • production → fatal if key missing
      • dev / test → warn and continue
      • perf → use mock key
      • default → fatal for unknown mode
    • Prevents non-production environments from aborting on missing keys.
  • Documentation changes

    • README.md
    • Added a Run section showing how to export MODE and BASE_PATH.
    • Clarified available modes: production, dev, test, perf.
    • Minor formatting cleanup.

🎯 Motivation

Previously, missing push-key files caused startup failure even in development or testing environments.
This PR makes startup behavior mode-aware and updates the README to help contributors understand and use these modes correctly.

- Added section on how to export MODE and BASE_PATH before running
- Clarified available modes: production / dev / test / perf

Signed-off-by: acture <acturea@gmail.com>
Refactor `getMipushKey()` to behave differently across environments:
- In production: fatal on missing key.
- In dev/test: warn and continue with empty key.
- In perf: use mock key.
- Default: fatal for unknown mode.

This prevents non-production environments from crashing when the Mipush key
is not present, while preserving strict validation in production.
@w568w w568w self-requested a review November 1, 2025 05:15
Copy link
Copy Markdown
Contributor

@w568w w568w left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@w568w w568w merged commit 9d637db into OpenTreeHole:main Nov 1, 2025
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