mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
feat: add install mode verification
This commit is contained in:
parent
6e9998d45c
commit
ce50fa760f
7 changed files with 64 additions and 15 deletions
|
|
@ -1,3 +1,4 @@
|
|||
from gettext import install
|
||||
from typing import Literal, Optional
|
||||
from pydantic import BaseModel
|
||||
import os
|
||||
|
|
@ -16,6 +17,7 @@ class CookieConfig(BaseModel):
|
|||
|
||||
class GeneralConfig(BaseModel):
|
||||
development_mode: bool
|
||||
install_mode: bool
|
||||
|
||||
|
||||
class SecurityConfig(BaseModel):
|
||||
|
|
@ -71,6 +73,10 @@ def get_learnhouse_config() -> LearnHouseConfig:
|
|||
development_mode = env_development_mode or yaml_config.get("general", {}).get(
|
||||
"development_mode"
|
||||
)
|
||||
env_install_mode = os.environ.get("LEARNHOUSE_INSTALL_MODE")
|
||||
install_mode = env_install_mode or yaml_config.get("general", {}).get(
|
||||
"install_mode"
|
||||
)
|
||||
|
||||
# Security Config
|
||||
env_auth_jwt_secret_key = os.environ.get("LEARNHOUSE_AUTH_JWT_SECRET_KEY")
|
||||
|
|
@ -129,7 +135,7 @@ def get_learnhouse_config() -> LearnHouseConfig:
|
|||
|
||||
env_content_delivery_type = os.environ.get("LEARNHOUSE_CONTENT_DELIVERY_TYPE")
|
||||
content_delivery_type: str = env_content_delivery_type or (
|
||||
(yaml_config.get("hosting_config", {}).get("content_delivery", {}).get("type"))
|
||||
(yaml_config.get("hosting_config", {}).get("content_delivery", {}).get("type"))
|
||||
or "filesystem"
|
||||
) # default to filesystem
|
||||
|
||||
|
|
@ -206,7 +212,9 @@ def get_learnhouse_config() -> LearnHouseConfig:
|
|||
site_name=site_name,
|
||||
site_description=site_description,
|
||||
contact_email=contact_email,
|
||||
general_config=GeneralConfig(development_mode=bool(development_mode)),
|
||||
general_config=GeneralConfig(
|
||||
development_mode=bool(development_mode), install_mode=bool(install_mode)
|
||||
),
|
||||
hosting_config=hosting_config,
|
||||
database_config=database_config,
|
||||
security_config=SecurityConfig(auth_jwt_secret_key=auth_jwt_secret_key),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue