bug: fix ephemeral container state when DATA_DIR is not set#15
Merged
nullable-eth merged 1 commit intomainfrom Jul 9, 2025
Merged
bug: fix ephemeral container state when DATA_DIR is not set#15nullable-eth merged 1 commit intomainfrom
nullable-eth merged 1 commit intomainfrom
Conversation
when DATA_DIR not set
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.
Fix: Restore Ephemeral Mode When DATA_DIR is Not Set
🐛 Issue Summary
PR #9 introduced persistent storage as a major enhancement, but inadvertently broke the application's previous ephemeral behavior when
DATA_DIRis not explicitly set. This caused the application to always attempt to create a/datadirectory, leading to permission errors in Docker containers and breaking backward compatibility.Related Issues:
/datadirectory📋 Root Cause Analysis
What PR #9 Changed
PR #9 added several excellent features:
The Problem
However, the persistent storage implementation made storage mandatory rather than optional:
This meant that even when users didn't set
DATA_DIR, the application would:/datadirectoryos.MkdirAll(dataDir, 0755)The Error
🔧 Solution
This PR restores the ephemeral behavior when
DATA_DIRis not set while preserving all the new functionality when it is set.Changes Made
1. Optional Storage Configuration
2. Conditional Storage Initialization
3. Conditional Storage Operations
4. Clear User Feedback
📊 Behavior Comparison
Before This Fix
/dataAfter This Fix
🧪 Testing
Build Success
go build -o labelarr ./cmd/labelarr # ✅ Builds successfullyTest Results
Runtime Behavior
Without DATA_DIR:
With DATA_DIR:
🔄 Migration Guide
For Users Running Ephemerally (No Change Required)
For Users Wanting Persistent Storage
🎯 Benefits
DATA_DIRnot set🚀 Impact
This fix resolves the breaking change introduced in PR #9 while preserving all the valuable new functionality. Users can now:
The application now behaves correctly in both modes, restoring the flexibility that existed before PR #9 while maintaining all the new capabilities.