Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: control dev mode with env var #877

Merged
merged 15 commits into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs_src/src/pages/documentation/api_reference/robyn_env.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ Batman wanted to configure the server through an environment file. Changing code
- `ROBYN_BROWSER_OPEN`: Open the browser on successful start.
- Default: `False`
- Example: `ROBYN_BROWSER_OPEN=True`
- `ROBYN_DEV_MODE`: Configures the dev mode
- Default: `False`
sansyrox marked this conversation as resolved.
Show resolved Hide resolved
- Example: `ROBYN_DEV_MODE=True`
- `ROBYN_MAX_PAYLOAD_SIZE`: Sets the maximum payload size for requests in bytes.
- Default: `1000000` bytes
- Example: `ROBYN_MAX_PAYLOAD_SIZE=1000000`
Expand All @@ -40,6 +43,7 @@ ROBYN_PORT=8080
ROBYN_HOST=127.0.0.1
RANDOM_ENV=123
ROBYN_BROWSER_OPEN=True
ROBYN_DEV_MODE=True
ROBYN_MAX_PAYLOAD_SIZE=1000000
```

Expand Down
7 changes: 7 additions & 0 deletions robyn/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from InquirerPy.base.control import Choice
from .argument_parser import Config
from .reloader import create_rust_file, setup_reloader
from robyn.env_populator import load_vars
from robyn.robyn import get_version
from pathlib import Path
import shutil
Expand Down Expand Up @@ -104,6 +105,12 @@ def start_app_normally(config: Config):

def run():
config = Config()

load_vars(project_root=os.path.dirname(os.path.abspath(config.file_path)))

if not config.dev:
config.dev = bool(os.getenv("ROBYN_DEV_MODE", False))
VishnuSanal marked this conversation as resolved.
Show resolved Hide resolved

if config.create:
create_robyn_app()

Expand Down
Loading