feat: improve db config
This commit is contained in:
parent
5e145c31b9
commit
94d24a9530
|
@ -1,12 +1,21 @@
|
||||||
import os
|
import os
|
||||||
|
import dotenv
|
||||||
|
|
||||||
|
dotenv.load_dotenv()
|
||||||
|
|
||||||
# redis config
|
# redis config
|
||||||
REDIS_DB_HOST = "127.0.0.1" # your redis host
|
REDIS_DB_HOST = "127.0.0.1" # your redis host
|
||||||
REDIS_DB_PWD = os.getenv("REDIS_DB_PWD", "123456") # your redis password
|
REDIS_DB_PWD = os.getenv("REDIS_DB_PWD", "123456") # your redis password
|
||||||
|
|
||||||
# mysql config
|
# mysql config
|
||||||
RELATION_DB_PWD = os.getenv("RELATION_DB_PWD", "123456") # your relation db password
|
RELATION_DB_PWD = os.getenv("RELATION_DB_PWD", "123456")
|
||||||
RELATION_DB_URL = f"mysql://root:{RELATION_DB_PWD}@localhost:3306/media_crawler"
|
RELATION_DB_USER = os.getenv("RELATION_DB_USER", "root")
|
||||||
|
RELATION_DB_HOST = os.getenv("RELATION_DB_HOST", "localhost")
|
||||||
|
RELATION_DB_PORT = os.getenv("RELATION_DB_PORT", "3306")
|
||||||
|
RELATION_DB_NAME = os.getenv("RELATION_DB_NAME", "media_crawler")
|
||||||
|
|
||||||
|
|
||||||
|
RELATION_DB_URL = f"mysql://{RELATION_DB_USER}:{RELATION_DB_PWD}@{RELATION_DB_HOST}:{RELATION_DB_PORT}/{RELATION_DB_NAME}"
|
||||||
|
|
||||||
# sqlite3 config
|
# sqlite3 config
|
||||||
# RELATION_DB_URL = f"sqlite://data/media_crawler.sqlite"
|
# RELATION_DB_URL = f"sqlite://data/media_crawler.sqlite"
|
||||||
|
|
|
@ -10,3 +10,4 @@ pydantic==2.5.2
|
||||||
aiofiles~=23.2.1
|
aiofiles~=23.2.1
|
||||||
fastapi==0.110.2
|
fastapi==0.110.2
|
||||||
uvicorn==0.29.0
|
uvicorn==0.29.0
|
||||||
|
python-dotenv==1.0.1
|
||||||
|
|
Loading…
Reference in New Issue