Fix Oban configuration and status checks - #192
Merged
Merged
Conversation
Fixed issue where mix phoenix_kit.status was showing "Connection failed"
even when the database was properly configured and accessible.
Problem:
- The task attempted to minimize app startup to avoid conflicts
- Complex conditional logic in ensure_app_started/0 failed to properly
initialize the Ecto repository
- Repository process was not available during status checks
Solution:
- Simplified run/1 to use standard Mix.Task.run("app.start")
- Removed unnecessary ensure_app_started/0 function
- Now properly starts the application with all dependencies including repo
Result:
- Database connection check now works correctly in all installations
- Status command shows accurate "Connected ✅" when database is available
- Will work consistently across all PhoenixKit installations
The message shown to users when configuration is missing did not mention Oban (background jobs for file processing), although the code already checks for Oban configuration and adds it when missing. This created confusion as: - The code checks 3 configurations (Ueberauth, Hammer, Oban) - The message only mentioned 2 (Ueberauth, Hammer) - install.ex already had the correct message with Oban - update.ex was missing this line Now both install.ex and update.ex show consistent messages to users about all required configurations.
This commit fixes the infinite loop issue where mix phoenix_kit.update
would get stuck checking for Oban configuration and never execute
migrations.
Problems fixed:
1. has_active_oban_config? was checking for hardcoded app name
- BEFORE: Searched for "config :phoenix_kit, Oban"
- AFTER: Searches for ", Oban" to match any app name
- This fix applied to both install.ex and update.ex
2. No automatic restart after adding configuration
- Commands now automatically restart instead of asking user
- Uses is_retry flag and recursive run(argv) call
- Prevents infinite loops with {:missing, true} safety check
3. Removed unused code that caused compilation warnings
- Removed unused 'result' variable in both files
- Removed show_config_added_message/1 function (no longer needed)
Technical implementation:
- Pattern match on {config_status, is_retry} tuple
- First pass {:missing, false}: Add config + automatic restart
- Second pass {:ok, _}: Execute migrations normally
- Safety check {:missing, true}: Prevent infinite loops
Results:
- mix phoenix_kit.update now completes in one command
- Automatically detects missing Oban config (any app name)
- Automatically adds config and reruns
- Executes migrations without manual intervention
- No more "run again" messages - fully automatic
Also includes:
- Comment explaining igniter usage in mix.exs
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.
Summary
Changes
Bug Fixes
Test Plan