diff --git a/federation/commands/sync_data.go b/federation/commands/sync_data.go index 2151c51d8..ce629f434 100644 --- a/federation/commands/sync_data.go +++ b/federation/commands/sync_data.go @@ -2,7 +2,6 @@ package commands import ( "context" - "time" cs "github.com/cortezaproject/corteza-server/compose/service" "github.com/cortezaproject/corteza-server/federation/service" @@ -21,6 +20,6 @@ func commandSyncData(ctx context.Context) func(*cobra.Command, []string) { ss.DefaultRole) syncData := service.WorkerData(syncService, service.DefaultLogger) - syncData.Watch(ctx, time.Second*30, 50) + syncData.Watch(ctx, service.DefaultOptions.DataMonitorInterval, service.DefaultOptions.DataPageSize) } } diff --git a/federation/commands/sync_structure.go b/federation/commands/sync_structure.go index 2cd309663..2e2bff2c8 100644 --- a/federation/commands/sync_structure.go +++ b/federation/commands/sync_structure.go @@ -2,7 +2,6 @@ package commands import ( "context" - "time" cs "github.com/cortezaproject/corteza-server/compose/service" "github.com/cortezaproject/corteza-server/federation/service" @@ -21,6 +20,6 @@ func commandSyncStructure(ctx context.Context) func(*cobra.Command, []string) { ss.DefaultRole) syncStructure := service.WorkerStructure(syncService, service.DefaultLogger) - syncStructure.Watch(ctx, time.Second*service.DefaultOptions.StructureMonitorInterval, service.DefaultOptions.StructurePageSize) + syncStructure.Watch(ctx, service.DefaultOptions.StructureMonitorInterval, service.DefaultOptions.StructurePageSize) } } diff --git a/federation/service/processer_structure.go b/federation/service/processer_structure.go index 456361ccd..855660071 100644 --- a/federation/service/processer_structure.go +++ b/federation/service/processer_structure.go @@ -41,8 +41,7 @@ func (dp *structureProcesser) Process(ctx context.Context, payload []byte) (Proc }, nil } - // get the user that is tied to this node - ctx = auth.SetIdentityToContext(ctx, dp.User) + ctx = auth.SetSuperUserContext(ctx) for _, em := range o { new := &types.SharedModule{ diff --git a/pkg/options/federation.gen.go b/pkg/options/federation.gen.go index 2c58e108a..5df883f35 100644 --- a/pkg/options/federation.gen.go +++ b/pkg/options/federation.gen.go @@ -26,7 +26,15 @@ type ( // Federation initializes and returns a FederationOpt with default values func Federation() (o *FederationOpt) { - o = &FederationOpt{} + o = &FederationOpt{ + Enabled: false, + Label: "Federation label", + Host: "Federation host", + StructureMonitorInterval: time.Minute * 2, + StructurePageSize: 1, + DataMonitorInterval: time.Second * 60, + DataPageSize: 100, + } fill(o) diff --git a/pkg/options/federation.yaml b/pkg/options/federation.yaml index aa434f834..50dcbec94 100644 --- a/pkg/options/federation.yaml +++ b/pkg/options/federation.yaml @@ -6,28 +6,42 @@ imports: props: - name: Enabled type: bool + default: false env: FEDERATION_ENABLED + description: Federation enabled on system, it toggles rest API endpoints, possibility to map modules in Compose and sync itself - name: Label type: string + default: "Federation label" env: FEDERATION_LABEL + description: Federation label - name: Host type: string + default: "Federation host" env: FEDERATION_HOST + description: Host that is used during node pairing, also included in invitation - name: StructureMonitorInterval type: time.Duration + default: time.Minute * 2 env: FEDERATION_SYNC_STRUCTURE_MONITOR_INTERVAL + description: Delay in seconds for structure sync - name: StructurePageSize type: int + default: 1 env: FEDERATION_SYNC_STRUCTURE_PAGE_SIZE + description: Bulk size in fetching for structure sync - name: DataMonitorInterval type: time.Duration + default: time.Second * 60 env: FEDERATION_SYNC_DATA_MONITOR_INTERVAL + description: Delay in seconds for data sync - name: DataPageSize type: int + default: 100 env: FEDERATION_SYNC_DATA_PAGE_SIZE + description: Bulk size in fetching for data sync