allow programmatic configuration of Redis storage (beyond NICEGUI_REDIS_URL) #5282
AlePiccin
started this conversation in
Ideas / Feature Requests
Replies: 1 comment
-
Thanks @AlePiccin. This reminds me of #4840 from @alydersen. But if it works would be much better than multiple env vars. Anyone up to try a pull request? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
NiceGUI currently enables Redis-backed storage by installing nicegui[redis] and setting the NICEGUI_REDIS_URL (and optionally REDIS_TIMEOUT) environment variables. This works, but relying solely on env vars makes it harder to:
Configure apps dynamically at runtime (e.g., different Redis instances per tenant or per environment).
Keep all configuration in one place (e.g., a Settings object via Pydantic/BaseSettings).
Write hermetic tests that swap storage backends or inject a temporary Redis URL.
Run multiple NiceGUI apps in the same process with different storage configs.
Override or extend connection parameters (timeouts, SSL, credentials, pooling) without introducing more env vars.
Describe the solution you’d like
Expose a programmatic API to configure Redis storage before ui.run() (or app startup). For example, any of the following patterns would solve the problem:
Option A: method on
app.storage
Option B: pass a backend object
Beta Was this translation helpful? Give feedback.
All reactions