Skip to content

Commit b28f873

Browse files
authored
ENG-7548: update rx.Config docstring (#5752)
* update rx.Config docstring * update rx.Config docstring
1 parent 39a07b6 commit b28f873

File tree

1 file changed

+33
-6
lines changed

1 file changed

+33
-6
lines changed

reflex/config.py

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -267,24 +267,51 @@ class BaseConfig:
267267

268268
@dataclasses.dataclass(kw_only=True, init=False)
269269
class Config(BaseConfig):
270-
"""The config defines runtime settings for the app.
270+
"""Configuration class for Reflex applications.
271271
272-
By default, the config is defined in an `rxconfig.py` file in the root of the app.
272+
The config defines runtime settings for your app including server ports, database connections,
273+
frontend packages, and deployment settings.
274+
275+
By default, the config is defined in an `rxconfig.py` file in the root of your app:
273276
274277
```python
275278
# rxconfig.py
276279
import reflex as rx
277280
278281
config = rx.Config(
279282
app_name="myapp",
280-
api_url="http://localhost:8000",
283+
# Server configuration
284+
frontend_port=3000,
285+
backend_port=8000,
286+
# Database
287+
db_url="postgresql://user:pass@localhost:5432/mydb",
288+
# Additional frontend packages
289+
frontend_packages=["react-icons"],
290+
# CORS settings for production
291+
cors_allowed_origins=["https://mydomain.com"],
281292
)
282293
```
283294
284-
Every config value can be overridden by an environment variable with the same name in uppercase and a REFLEX_ prefix.
285-
For example, `db_url` can be overridden by setting the `REFLEX_DB_URL` environment variable.
295+
## Environment Variable Overrides
296+
297+
Any config value can be overridden by setting an environment variable with the `REFLEX_`
298+
prefix and the parameter name in uppercase:
299+
300+
```bash
301+
REFLEX_DB_URL="postgresql://user:pass@localhost/db" reflex run
302+
REFLEX_FRONTEND_PORT=3001 reflex run
303+
```
304+
305+
## Key Configuration Areas
306+
307+
- **App Settings**: `app_name`, `loglevel`, `telemetry_enabled`
308+
- **Server**: `frontend_port`, `backend_port`, `api_url`, `cors_allowed_origins`
309+
- **Database**: `db_url`, `async_db_url`, `redis_url`
310+
- **Frontend**: `frontend_packages`, `react_strict_mode`
311+
- **State Management**: `state_manager_mode`, `state_auto_setters`
312+
- **Plugins**: `plugins`, `disable_plugins`
286313
287-
See the [configuration](https://reflex.dev/docs/getting-started/configuration/) docs for more info.
314+
See the [configuration docs](https://reflex.dev/docs/advanced-onboarding/configuration) for complete details on all available options.
288315
"""
289316

290317
# Track whether the app name has already been validated for this Config instance.

0 commit comments

Comments
 (0)