Skip to content

Commit f223325

Browse files
committed
add redis config settings
1 parent acbbcfe commit f223325

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

.env.example

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
# Port to serve app on.
2-
PORT = 5000
2+
PORT = 5000
3+
LOCAL_REDIS_URL = redis://username:password@localhost:6379

app/config.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,19 @@
22
import functools
33
import logging
44

5-
import pydantic
5+
from pydantic import AnyUrl, BaseSettings, HttpUrl
66

77
CFG_LOGGER = logging.getLogger("app.config")
88

99

10-
class _Settings(pydantic.BaseSettings):
10+
class _Settings(BaseSettings):
1111
port: int = 5000
12+
rediscloud_url: HttpUrl = None
13+
local_redis_url: AnyUrl = "redis://localhost:6379"
1214

1315

1416
@functools.lru_cache()
15-
def get_settings(**kwargs):
17+
def get_settings(**kwargs) -> BaseSettings:
1618
"""
1719
Read settings from the environment or `.env` file.
1820
https://pydantic-docs.helpmanual.io/usage/settings/#dotenv-env-support

0 commit comments

Comments
 (0)