make mongo uri universal across flask apps

This commit is contained in:
Connor Rhodes 2026-05-24 07:50:20 -05:00
parent 605c25b8b0
commit 3c9618f0b4
3 changed files with 9 additions and 0 deletions

5
_config.py Normal file
View file

@ -0,0 +1,5 @@
import tomllib
from pathlib import Path
_cfg = tomllib.loads((Path(__file__).parent / "config.toml").read_text())
MONGO_URI = _cfg["mongo"]["uri"]

2
config.toml Normal file
View file

@ -0,0 +1,2 @@
[mongo]
uri = "mongodb://root:3wwfoUjyk2E2zWELXFlLuHqfw1ALlOp4pb2H5Vq3TImbMIHL2h1u8Jej2mjzCPl@docdb.connorrhodes.com:35563?tls=true&tlsAllowInvalidCertificates=true"

View file

@ -6,6 +6,8 @@ from flask import Flask, render_template_string
from werkzeug.middleware.dispatcher import DispatcherMiddleware
from werkzeug.serving import run_simple
sys.path.insert(0, str(Path(__file__).parent))
CATEGORIES = ["personal", "home", "work"]
root = Flask(__name__)