docs(env): document multi-tenant overlay envs (EVO-1631 NEST-3)#57
Merged
marcelogorutuba merged 1 commit intoJun 12, 2026
Merged
Conversation
Document EVO_EXTENSIONS_BOOTSTRAP, MULTI_TENANT_ENABLED and DEFAULT_TENANT_ID in .env.example so operators wiring the evo-enterprise-licensing-nestjs overlay have a single discoverable surface, and clarify that POSTGRES_DB_USERNAME must become a NOBYPASSRLS role (evo_app, EVO-1620) for multi-tenant deployments. Other NEST-3 ACs verified as already covered upstream: * main.ts boot order — loadExternalExtensions() already runs before NestFactory.create (lines 136 / 142). * DataSource user — already env-driven via POSTGRES_DB_USERNAME. * Migration 1763000000000-AddTenantIdAndRLSToAllEntities — owned by the overlay package; operators run it via the overlay's own migration script. * tenant_id field in BaseEntity — server-side DEFAULT from app.current_tenant_id GUC (migration 1763100000000) plus RLS already cover stamping and filtering, so community entities stay enterprise-unaware. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Reviewer's guide (collapsed on small PRs)Reviewer's GuideUpdates .env.example documentation to describe how to configure multi-tenant overlay environments while preserving the current OSS single-tenant defaults and behavior. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
EVO_EXTENSIONS_BOOTSTRAP,MULTI_TENANT_ENABLED,DEFAULT_TENANT_IDin.env.example— the surface operators need to wireevo-enterprise-licensing-nestjsagainst an evo-flow deployment.POSTGRES_DB_USERNAMEflagging the NOBYPASSRLS-role requirement for multi-tenant deployments (evo_app, EVO-1620).postgres) intact so a freshcp .env.example .envstill works out of the box.Why this PR is docs-only
NEST-3's other ACs (boot order, DataSource user swap, tenant_id on entities, migration run) were already covered by upstream work and don't need community changes:
EVO_EXTENSIONS_BOOTSTRAPresolved beforeNestFactory.createsrc/main.ts:136runsloadExternalExtensions()beforeNestFactory.create(...)on line 142evo_appsrc/database/ormconfig.tsreadsPOSTGRES_DB_USERNAME; only docs change requiredtenant_idcolumn carved into community entities1763100000000-AddTenantIdDefaultFromGucaddsDEFAULT current_setting('app.current_tenant_id', true)::uuidserver-side. RLS filters reads, GUC stamps writes — community entities stay tenant-unaware. (Also, onlyUserextends a local abstract entity; the 15 other tenant-scoped entities declare columns directly, so a singleBaseEntityedit wouldn't have propagated anyway.)1763000000000-AddTenantIdAndRLSToAllEntitiesapplies cleanly@evoapi/enterprise-licensing-nestjsand is run via the overlay's ownmigration:run. evo-flow'sdata-source.tsdoesn't need to know about it.TenantStampSubscriber: dropped from scope
The original spec called for a TypeORM
EntitySubscriberInterfaceglobal subscriber to stamptenantIdonbeforeInsert. With migration1763100000000-AddTenantIdDefaultFromGucalready merged, the Postgres DEFAULT carves the column server-side from theapp.current_tenant_idGUC — making the subscriber dead code with the same failure mode (no GUC ⇒ NULL ⇒ RLS rejects ≡ no CLS ⇒ subscriber no-ops ⇒ RLS rejects). Kept the work cut.Test plan
cp .env.example .envstill produces a runnable OSS config (POSTGRES_DB_USERNAME=postgres,EVO_EXTENSIONS_BOOTSTRAP=unset → no overlay attempted).EVO_EXTENSIONS_BOOTSTRAP=@evoapi/enterprise-licensing-nestjs+POSTGRES_DB_USERNAME=evo_app, the overlay'sregister()wires the real enricher and the connection respects RLS — covered end-to-end by SMOKE-1 (EVO-1633).Linked issue
🤖 Generated with Claude Code
Summary by Sourcery
Document multi-tenant overlay environment variables and requirements in the example env file to support wiring the enterprise licensing overlay while keeping the default OSS setup unchanged.
Documentation: