mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-04-28 11:30:15 +00:00
Implements Phase 1-2 of multi-tenancy support using a directory-per-tenant strategy that preserves existing file-based persistence. Key changes: - Add MultiTenantPersistence manager for org-scoped config routing - Add TenantMiddleware for X-Pulse-Org-ID header extraction and context propagation - Add MultiTenantMonitor for per-tenant monitor lifecycle management - Refactor handlers (ConfigHandlers, AlertHandlers, AIHandlers, etc.) to be context-aware with getConfig(ctx)/getMonitor(ctx) helpers - Add Organization model for future tenant metadata - Update server and router to wire multi-tenant components All handlers maintain backward compatibility via legacy field fallbacks for single-tenant deployments using the "default" org.
34 lines
1 KiB
Go
34 lines
1 KiB
Go
package config
|
|
|
|
// GetGuestMetadataStore returns the guest metadata store, creating it if necessary
|
|
func (c *ConfigPersistence) GetGuestMetadataStore() *GuestMetadataStore {
|
|
c.metadataMu.Lock()
|
|
defer c.metadataMu.Unlock()
|
|
|
|
if c.guestMetadataStore == nil {
|
|
c.guestMetadataStore = NewGuestMetadataStore(c.configDir, c.fs)
|
|
}
|
|
return c.guestMetadataStore
|
|
}
|
|
|
|
// GetDockerMetadataStore returns the docker metadata store, creating it if necessary
|
|
func (c *ConfigPersistence) GetDockerMetadataStore() *DockerMetadataStore {
|
|
c.metadataMu.Lock()
|
|
defer c.metadataMu.Unlock()
|
|
|
|
if c.dockerMetadataStore == nil {
|
|
c.dockerMetadataStore = NewDockerMetadataStore(c.configDir, c.fs)
|
|
}
|
|
return c.dockerMetadataStore
|
|
}
|
|
|
|
// GetHostMetadataStore returns the host metadata store, creating it if necessary
|
|
func (c *ConfigPersistence) GetHostMetadataStore() *HostMetadataStore {
|
|
c.metadataMu.Lock()
|
|
defer c.metadataMu.Unlock()
|
|
|
|
if c.hostMetadataStore == nil {
|
|
c.hostMetadataStore = NewHostMetadataStore(c.configDir, c.fs)
|
|
}
|
|
return c.hostMetadataStore
|
|
}
|