From 72b49b89aafd79b0c5979c4bc793b976c7919f40 Mon Sep 17 00:00:00 2001 From: Ahmad Hakim Date: Tue, 2 Sep 2025 15:57:15 +0300 Subject: [PATCH 1/2] update rx.Config docstring --- reflex/config.py | 39 +++++++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/reflex/config.py b/reflex/config.py index 086b819939e..b89599fea79 100644 --- a/reflex/config.py +++ b/reflex/config.py @@ -267,9 +267,12 @@ class BaseConfig: @dataclasses.dataclass(kw_only=True, init=False) class Config(BaseConfig): - """The config defines runtime settings for the app. + """Configuration class for Reflex applications. - By default, the config is defined in an `rxconfig.py` file in the root of the app. + The config defines runtime settings for your app including server ports, database connections, + frontend packages, and deployment settings. + + By default, the config is defined in an `rxconfig.py` file in the root of your app: ```python # rxconfig.py @@ -277,14 +280,38 @@ class Config(BaseConfig): config = rx.Config( app_name="myapp", - api_url="http://localhost:8000", + # Server configuration + frontend_port=3000, + backend_port=8000, + # Database + db_url="postgresql://user:pass@localhost:5432/mydb", + # Additional frontend packages + frontend_packages=["react-icons"], + # CORS settings for production + cors_allowed_origins=["https://mydomain.com"], ) ``` - Every config value can be overridden by an environment variable with the same name in uppercase and a REFLEX_ prefix. - For example, `db_url` can be overridden by setting the `REFLEX_DB_URL` environment variable. + ## Environment Variable Overrides + + Any config value can be overridden by setting an environment variable with the `REFLEX_` + prefix and the parameter name in uppercase: + + ```bash + REFLEX_DB_URL="postgresql://user:pass@localhost/db" reflex run + REFLEX_FRONTEND_PORT=3001 reflex run + ``` + + ## Key Configuration Areas + + - **App Settings**: `app_name`, `loglevel`, `telemetry_enabled` + - **Server**: `frontend_port`, `backend_port`, `api_url`, `cors_allowed_origins` + - **Database**: `db_url`, `async_db_url`, `redis_url` + - **Frontend**: `frontend_packages`, `react_strict_mode` + - **State Management**: `state_manager_mode`, `state_auto_setters` + - **Plugins**: `plugins`, `disable_plugins` - See the [configuration](https://reflex.dev/docs/getting-started/configuration/) docs for more info. + See the [configuration docs](https://reflex.dev/docs/getting-started/configuration/) for complete details on all available options. """ # Track whether the app name has already been validated for this Config instance. From efa36cf1119e49f133ce969924a4d2464ee1b739 Mon Sep 17 00:00:00 2001 From: Ahmad Hakim Date: Tue, 2 Sep 2025 15:59:22 +0300 Subject: [PATCH 2/2] update rx.Config docstring --- reflex/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reflex/config.py b/reflex/config.py index b89599fea79..4c4404a16f6 100644 --- a/reflex/config.py +++ b/reflex/config.py @@ -311,7 +311,7 @@ class Config(BaseConfig): - **State Management**: `state_manager_mode`, `state_auto_setters` - **Plugins**: `plugins`, `disable_plugins` - See the [configuration docs](https://reflex.dev/docs/getting-started/configuration/) for complete details on all available options. + See the [configuration docs](https://reflex.dev/docs/advanced-onboarding/configuration) for complete details on all available options. """ # Track whether the app name has already been validated for this Config instance.