mongrator.config¶
mongrator.config
¶
MigratorConfig
dataclass
¶
Immutable configuration for a migrator instance.
Source code in src/mongrator/config.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | |
from_toml(path)
classmethod
¶
Load configuration from a TOML file (e.g. mongrator.toml).
Source code in src/mongrator/config.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | |
from_env(dotenv_path=None)
classmethod
¶
Load configuration from environment variables.
If dotenv_path is given and the file exists, its values are used as defaults — real environment variables always take precedence.
Variables
MONGRATOR_URI — MongoDB connection URI (required) MONGRATOR_DB — database name (required) MONGRATOR_MIGRATIONS_DIR — path to migrations directory (default: migrations) MONGRATOR_COLLECTION — tracking collection name (default: mongrator_migrations)
Source code in src/mongrator/config.py
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | |