mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
feat: init migration script from mongodb
This commit is contained in:
parent
99146ca02b
commit
2d822459fb
7 changed files with 307 additions and 8 deletions
|
|
@ -47,6 +47,7 @@ class HostingConfig(BaseModel):
|
|||
|
||||
class DatabaseConfig(BaseModel):
|
||||
sql_connection_string: Optional[str]
|
||||
mongo_connection_string: Optional[str]
|
||||
|
||||
|
||||
class LearnHouseConfig(BaseModel):
|
||||
|
|
@ -105,9 +106,7 @@ def get_learnhouse_config() -> LearnHouseConfig:
|
|||
env_allowed_origins = env_allowed_origins.split(",")
|
||||
env_allowed_regexp = os.environ.get("LEARNHOUSE_ALLOWED_REGEXP")
|
||||
env_self_hosted = os.environ.get("LEARNHOUSE_SELF_HOSTED")
|
||||
env_sql_connection_string = os.environ.get(
|
||||
"LEARNHOUSE_SQL_CONNECTION_STRING"
|
||||
)
|
||||
env_sql_connection_string = os.environ.get("LEARNHOUSE_SQL_CONNECTION_STRING")
|
||||
|
||||
# Sentry Config
|
||||
env_sentry_dsn = os.environ.get("LEARNHOUSE_SENTRY_DSN")
|
||||
|
|
@ -170,6 +169,10 @@ def get_learnhouse_config() -> LearnHouseConfig:
|
|||
"database_config", {}
|
||||
).get("sql_connection_string")
|
||||
|
||||
mongo_connection_string = yaml_config.get("database_config", {}).get(
|
||||
"mongo_connection_string"
|
||||
)
|
||||
|
||||
# Sentry config
|
||||
# check if the sentry config is provided in the YAML file
|
||||
sentry_config_verif = (
|
||||
|
|
@ -210,7 +213,8 @@ def get_learnhouse_config() -> LearnHouseConfig:
|
|||
content_delivery=content_delivery,
|
||||
)
|
||||
database_config = DatabaseConfig(
|
||||
sql_connection_string=sql_connection_string
|
||||
sql_connection_string=sql_connection_string,
|
||||
mongo_connection_string=mongo_connection_string,
|
||||
)
|
||||
|
||||
# Create LearnHouseConfig object
|
||||
|
|
|
|||
|
|
@ -26,3 +26,4 @@ hosting_config:
|
|||
|
||||
database_config:
|
||||
sql_connection_string: postgresql://learnhouse:learnhouse@db:5432/learnhouse
|
||||
mongo_connection_string: mongodb://learnhouse:learnhouse@mongo:27017/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue