feat: Infrastructure multi-tenant avec isolation par sous-domaine
Une application SaaS éducative nécessite une séparation stricte des données entre établissements scolaires. L'architecture multi-tenant par sous-domaine (ecole-alpha.classeo.local) permet cette isolation tout en utilisant une base de code unique. Le choix d'une résolution basée sur les sous-domaines plutôt que sur des headers ou tokens facilite le routage au niveau infrastructure (reverse proxy) et offre une UX plus naturelle où chaque école accède à "son" URL dédiée.
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
# Put parameters here that don't need to change on each machine where the app is deployed
|
||||
# https://symfony.com/doc/current/best_practices.html#use-parameters-for-application-configuration
|
||||
parameters:
|
||||
tenant.base_domain: '%env(TENANT_BASE_DOMAIN)%'
|
||||
|
||||
services:
|
||||
# default configuration for services in this file
|
||||
@@ -25,3 +26,20 @@ services:
|
||||
# Domain services need to be registered explicitly to avoid framework coupling
|
||||
# Example: App\Administration\Application\Command\:
|
||||
# resource: '../src/Administration/Application/Command/'
|
||||
|
||||
# Tenant services
|
||||
App\Shared\Infrastructure\Tenant\TenantResolver:
|
||||
arguments:
|
||||
$baseDomain: '%tenant.base_domain%'
|
||||
|
||||
# TenantRegistry est configuré par environnement :
|
||||
# - dev: config/packages/dev/tenant.yaml (tenants de test)
|
||||
# - prod: à configurer via admin ou env vars
|
||||
|
||||
App\Shared\Infrastructure\Tenant\Command\CreateTenantDatabaseCommand:
|
||||
arguments:
|
||||
$masterDatabaseUrl: '%env(DATABASE_URL)%'
|
||||
|
||||
App\Shared\Infrastructure\Tenant\Command\TenantMigrateCommand:
|
||||
arguments:
|
||||
$projectDir: '%kernel.project_dir%'
|
||||
|
||||
Reference in New Issue
Block a user