feat: make rxconfig.py filename configurable via env vars#6124
Open
timon0305 wants to merge 3 commits intoreflex-dev:mainfrom
Open
feat: make rxconfig.py filename configurable via env vars#6124timon0305 wants to merge 3 commits intoreflex-dev:mainfrom
timon0305 wants to merge 3 commits intoreflex-dev:mainfrom
Conversation
… and REFLEX_CONFIG_FILE env vars (reflex-dev#6117)
Contributor
Greptile OverviewGreptile SummaryThis PR makes the project config filename configurable via Main issue to address before merge: a few call sites treat Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant Env as Environment Vars
participant C as constants.Config
participant Exec as utils.exec.get_reload_paths
participant Ren as utils.rename.rename_path_up_tree
User->>Env: set REFLEX_CONFIG_MODULE / REFLEX_CONFIG_FILE (optional)
Exec->>C: access Config.FILE
C->>Env: read env vars
C-->>Exec: Path to config (derived or env)
Exec->>Exec: _has_child_file(dir, str(Config.FILE))
Exec-->>Exec: decide app root / __init__.py cleanup
Ren->>C: access Config.FILE
C->>Env: read env vars
C-->>Ren: Path to config (derived or env)
Ren->>Ren: check (current_dir / Config.FILE).exists()
Ren-->>Ren: stop-at-root decision
|
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.
All Submissions:
Type of change
New Feature Submission:
Changes To Core Features:
Summary
Make the
rxconfig.pyconfig filename configurable via two new environment variables:REFLEX_CONFIG_MODULE— Python module name to import (default:rxconfig)REFLEX_CONFIG_FILE— Config file path on disk (default:{module_name}.py)This allows users to rename
rxconfig.pyto any filename they prefer, making the framework less opinionated about repo structure naming conventions.How it works
_ConfigMetaonconstants.ConfigmakesMODULEandFILEdynamic class-level properties that resolve from environment variables at access time"rxconfig.py"strings in error messages and file detection logic now useconstants.Config.FILErxconfig/rxconfig.pywhen no env vars are setFiles changed (5)
reflex/constants/config.py_ConfigMetametaclass to makeConfig.MODULEandConfig.FILEdynamicreflex/config.pyconstants.Config.FILEreflex/utils/exec.pyreflex/utils/prerequisites.pyreflex/utils/rename.pyUsage
Test results
closes #6117