mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-07-09 03:04:54 -04:00
fix db credentials show on logs/frontend (#602)
This commit is contained in:
parent
98c2138970
commit
4d853c4ca8
@ -63,7 +63,20 @@ def system_startup():
|
|||||||
start_scheduler()
|
start_scheduler()
|
||||||
logger.info("-----SYSTEM STARTUP----- \n")
|
logger.info("-----SYSTEM STARTUP----- \n")
|
||||||
logger.info("------APP SETTINGS------")
|
logger.info("------APP SETTINGS------")
|
||||||
logger.info(settings.json(indent=4, exclude={"SECRET", "DEFAULT_PASSWORD", "SFTP_PASSWORD", "SFTP_USERNAME"}))
|
logger.info(
|
||||||
|
settings.json(
|
||||||
|
indent=4,
|
||||||
|
exclude={
|
||||||
|
"SECRET",
|
||||||
|
"DEFAULT_PASSWORD",
|
||||||
|
"SFTP_PASSWORD",
|
||||||
|
"SFTP_USERNAME",
|
||||||
|
"DB_URL", # replace by DB_URL_PUBLIC for logs
|
||||||
|
"POSTGRES_USER",
|
||||||
|
"POSTGRES_PASSWORD",
|
||||||
|
},
|
||||||
|
)
|
||||||
|
)
|
||||||
create_general_event("Application Startup", f"Mealie API started on port {settings.API_PORT}")
|
create_general_event("Application Startup", f"Mealie API started on port {settings.API_PORT}")
|
||||||
|
|
||||||
|
|
||||||
|
@ -133,6 +133,20 @@ class AppSettings(BaseSettings):
|
|||||||
)
|
)
|
||||||
return determine_sqlite_path()
|
return determine_sqlite_path()
|
||||||
|
|
||||||
|
DB_URL_PUBLIC: str = "" # hide credentials to show on logs/frontend
|
||||||
|
|
||||||
|
@validator("DB_URL_PUBLIC", pre=True)
|
||||||
|
def public_db_url(cls, v: Optional[str], values: dict[str, Any]) -> str:
|
||||||
|
url = values.get("DB_URL")
|
||||||
|
engine = values.get("DB_ENGINE", "sqlite")
|
||||||
|
if engine == "postgres":
|
||||||
|
user = values.get("POSTGRES_USER")
|
||||||
|
password = values.get("POSTGRES_PASSWORD")
|
||||||
|
return url.replace(user, "*****", 1).replace(password, "*****", 1)
|
||||||
|
else:
|
||||||
|
# sqlite
|
||||||
|
return url
|
||||||
|
|
||||||
DEFAULT_GROUP: str = "Home"
|
DEFAULT_GROUP: str = "Home"
|
||||||
DEFAULT_EMAIL: str = "changeme@email.com"
|
DEFAULT_EMAIL: str = "changeme@email.com"
|
||||||
DEFAULT_PASSWORD: str = "MyPassword"
|
DEFAULT_PASSWORD: str = "MyPassword"
|
||||||
|
@ -25,7 +25,7 @@ async def get_debug_info():
|
|||||||
api_port=settings.API_PORT,
|
api_port=settings.API_PORT,
|
||||||
api_docs=settings.API_DOCS,
|
api_docs=settings.API_DOCS,
|
||||||
db_type=settings.DB_ENGINE,
|
db_type=settings.DB_ENGINE,
|
||||||
db_url=settings.DB_URL,
|
db_url=settings.DB_URL_PUBLIC,
|
||||||
default_group=settings.DEFAULT_GROUP,
|
default_group=settings.DEFAULT_GROUP,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user