feat: new run method & add local dev setup

This commit is contained in:
swve 2024-03-31 15:14:25 +02:00
parent 67c18a2d1e
commit 24be39f7e3
6 changed files with 27 additions and 6 deletions

View file

@ -1,8 +1,8 @@
import os
import yaml
from typing import Literal, Optional
from pydantic import BaseModel
import os
from dotenv import load_dotenv
import yaml
class SentryConfig(BaseModel):
@ -42,6 +42,7 @@ class ContentDeliveryConfig(BaseModel):
class HostingConfig(BaseModel):
domain: str
ssl: bool
port: int
use_default_org: bool
allowed_origins: list
allowed_regexp: str
@ -118,6 +119,7 @@ def get_learnhouse_config() -> LearnHouseConfig:
env_domain = os.environ.get("LEARNHOUSE_DOMAIN")
os.environ.get("LEARNHOUSE_PORT")
env_ssl = os.environ.get("LEARNHOUSE_SSL")
env_port = os.environ.get("LEARNHOUSE_PORT")
env_use_default_org = os.environ.get("LEARNHOUSE_USE_DEFAULT_ORG")
env_allowed_origins = os.environ.get("LEARNHOUSE_ALLOWED_ORIGINS")
env_cookie_domain = os.environ.get("LEARNHOUSE_COOKIE_DOMAIN")
@ -141,6 +143,7 @@ def get_learnhouse_config() -> LearnHouseConfig:
domain = env_domain or yaml_config.get("hosting_config", {}).get("domain")
ssl = env_ssl or yaml_config.get("hosting_config", {}).get("ssl")
port = env_port or yaml_config.get("hosting_config", {}).get("port")
use_default_org = env_use_default_org or yaml_config.get("hosting_config", {}).get(
"use_default_org"
)
@ -190,7 +193,6 @@ def get_learnhouse_config() -> LearnHouseConfig:
"database_config", {}
).get("sql_connection_string")
# AI Config
env_openai_api_key = os.environ.get("LEARNHOUSE_OPENAI_API_KEY")
env_is_ai_enabled = os.environ.get("LEARNHOUSE_IS_AI_ENABLED")
@ -248,6 +250,7 @@ def get_learnhouse_config() -> LearnHouseConfig:
hosting_config = HostingConfig(
domain=domain,
ssl=bool(ssl),
port=int(port),
use_default_org=bool(use_default_org),
allowed_origins=list(allowed_origins),
allowed_regexp=allowed_regexp,

View file

@ -2,6 +2,8 @@ site_name: LearnHouse
site_description: LearnHouse is an open-source platform tailored for learning experiences.
contact_email: hi@learnhouse.app
# This config is optimized for local development. You can change the values according to your needs.
general:
development_mode: true
install_mode: true
@ -12,6 +14,7 @@ security:
hosting_config:
domain: learnhouse.app
ssl: true
port: 1338
allowed_origins:
- http://localhost:3000
- http://localhost:3001
@ -29,7 +32,7 @@ mailing_config:
system_email_adress: ""
database_config:
sql_connection_string: postgresql://learnhouse:learnhouse@db:5432/learnhouse
sql_connection_string: postgresql://learnhouse:learnhouse@localhost:5432/learnhouse
redis_config:
redis_connection_string: redis://redis:6379/learnhouse
redis_connection_string: redis://localhost:6379/learnhouse