Skip to content

Commit 7d5b9fb

Browse files
committed
cloud
1 parent 22c53ce commit 7d5b9fb

2 files changed

Lines changed: 13 additions & 21 deletions

File tree

apps/server/objectstack.config.ts

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -124,17 +124,15 @@ async function createProjectStack() {
124124
baseUrl,
125125
controlDriverUrl: controlDbUrl,
126126
appBundles: createFsAppBundleResolver(),
127-
// Project-mode per-project plugins. Identical to the cloud default
128-
// except for the AppPlugin tail — we eagerly load the local
129-
// artifact bundle (if present) so the single project picks up
130-
// schema definitions without needing a control-plane app row.
127+
// Project-mode per-project plugins. The control plane (created by
128+
// `createCloudStack`'s preset) is the sole owner of identity,
129+
// authentication, security, audit, tenant catalogs, and packages —
130+
// their tables live in `control.db`. Each per-project kernel only
131+
// registers the engines needed to materialize that project's
132+
// **business data** schemas + records.
131133
basePlugins: async ({ projectId }: { projectId: string }) => {
132134
const { ObjectQLPlugin } = await import('@objectstack/objectql');
133135
const { MetadataPlugin } = await import('@objectstack/metadata');
134-
const { createTenantPlugin } = await import('@objectstack/service-tenant');
135-
const { AuthPlugin } = await import('@objectstack/plugin-auth');
136-
const { SecurityPlugin } = await import('@objectstack/plugin-security');
137-
const { AuditPlugin } = await import('@objectstack/plugin-audit');
138136
const { AppPlugin } = await import('@objectstack/runtime');
139137

140138
let artifactBundle: any = null;
@@ -155,10 +153,6 @@ async function createProjectStack() {
155153
environmentId: projectId,
156154
artifactSource: { mode: 'local-file', path: localArtifactPath },
157155
}),
158-
createTenantPlugin({ registerSystemObjects: true }),
159-
new AuthPlugin({ secret: authSecret, baseUrl }),
160-
new SecurityPlugin(),
161-
new AuditPlugin(),
162156
];
163157
if (artifactBundle) plugins.push(new AppPlugin(artifactBundle));
164158
return plugins;

packages/services/service-cloud/src/cloud-stack.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -85,22 +85,20 @@ export async function createCloudStack(config: CloudStackConfig): Promise<{
8585
process.env.OBJECTSTACK_DATABASE_AUTH_TOKEN || process.env.TURSO_AUTH_TOKEN || controlDriverAuthToken,
8686
);
8787

88-
// Default base plugins (cloud per-project kernel)
88+
// Default base plugins (per-project kernel — business data only).
89+
//
90+
// Identity, authentication, security, audit, and tenant catalogs are owned
91+
// exclusively by the control-plane kernel (see control-plane-preset.ts).
92+
// Their tables live in the control DB and must NOT be duplicated per project.
93+
// Each per-project kernel only registers the engines needed to materialise
94+
// that project's business-data schemas and records.
8995
const resolvedBasePlugins: BasePluginsFactory = basePlugins ?? (async ({ projectId, project }) => {
9096
const { ObjectQLPlugin } = await import('@objectstack/objectql');
9197
const { MetadataPlugin } = await import('@objectstack/metadata');
92-
const { createTenantPlugin } = await import('@objectstack/service-tenant');
93-
const { AuthPlugin } = await import('@objectstack/plugin-auth');
94-
const { SecurityPlugin } = await import('@objectstack/plugin-security');
95-
const { AuditPlugin } = await import('@objectstack/plugin-audit');
9698
const orgId = project.organization_id;
9799
return [
98100
new ObjectQLPlugin({ environmentId: projectId }),
99101
new MetadataPlugin({ watch: false, environmentId: projectId, organizationId: orgId }),
100-
createTenantPlugin({ registerSystemObjects: true }),
101-
new AuthPlugin({ secret: authSecret, baseUrl }),
102-
new SecurityPlugin(),
103-
new AuditPlugin(),
104102
];
105103
});
106104

0 commit comments

Comments
 (0)