feat(fallback): Add fallback image configuration and CLI support#21
Merged
nakamuraos merged 7 commits intomainfrom Apr 1, 2026
Merged
feat(fallback): Add fallback image configuration and CLI support#21nakamuraos merged 7 commits intomainfrom
nakamuraos merged 7 commits intomainfrom
Conversation
Add 6 new CLI arguments to support fallback image configuration: - fallback_image_data: Base64-encoded image data - fallback_image_path: Local file path - fallback_image_url: Upstream URL - fallback_image_http_code: HTTP status code (0 = use original) - fallback_image_ttl: Cache TTL in seconds (0 = use PP_TTL) - ttl: General response TTL in seconds All fields have env var mappings (PP_*) and appropriate defaults. Includes apply_to_env() entries and test coverage.
Add fallback field to AppState struct and load fallback image at startup in app.rs. Update controller tests to initialize fallback field. Add test to verify fallback is None by default when no fallback sources are configured.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces new configuration options for specifying a fallback image to be served when upstream image fetches fail, along with a general response TTL setting. It updates the configuration loader, CLI arguments, environment variable documentation, and adds relevant tests to ensure correct behavior. The main changes are grouped below by theme.
Fallback Image Configuration:
PP_FALLBACK_IMAGE_DATA,PP_FALLBACK_IMAGE_PATH,PP_FALLBACK_IMAGE_URL), HTTP code, and TTL, including logic to load these settings into the application state. (src/common/config/loader.rs,src/app.rs) [1] [2] [3] [4].env.samplewith detailed documentation and examples for the fallback image configuration.General Response TTL:
PP_TTLenvironment variable and corresponding configuration field and CLI argument for setting a general response TTL, including documentation in.env.sampleand CLI help. [1] [2] [3] [4]Documentation Improvements:
README.mdto direct users to comprehensive environment variable documentation, reflecting the expanded configuration options.Code Quality and Consistency:
These changes collectively improve the application's robustness in handling upstream failures and provide clearer, more flexible configuration options for users.