func (m *Module) SetEventingSchemaConfig(ctx context.Context, eventingSchemas config.EventingSchemas) error {
	helpers.Logger.LogDebug(helpers.GetRequestID(ctx), "Setting schema config of eventing module", nil)
	return m.eventing.SetSchemaConfig(eventingSchemas)
}
SetEventingSchemaConfig sets the config of eventing module
package modules
import (
	"context"
	"github.com/spaceuptech/helpers"
	"github.com/spaceuptech/space-cloud/gateway/config"
	schemaHelpers "github.com/spaceuptech/space-cloud/gateway/modules/schema/helpers"
)
func (m *Module) SetInitialProjectConfig(ctx context.Context, projects config.Projects) error {
	for projectID, project := range projects {
		helpers.Logger.LogDebug(helpers.GetRequestID(ctx), "Setting config of db module", nil)
		if err := m.db.SetConfig(projectID, project.DatabaseConfigs); err != nil {
			_ = helpers.Logger.LogError(helpers.GetRequestID(ctx), "Unable to set db module config", err, nil)
		}
		if err := m.db.SetProjectAESKey(project.ProjectConfig.AESKey); err != nil {
			_ = helpers.Logger.LogError(helpers.GetRequestID(ctx), "Unable to set aes key for db module config", err, nil)
		}
		schemaDoc, err := schemaHelpers.Parser(project.DatabaseSchemas)
		if err != nil {
			return err
		}
		if err := m.db.SetSchemaConfig(ctx, schemaDoc, project.DatabaseSchemas); err != nil {
			_ = helpers.Logger.LogError(helpers.GetRequestID(ctx), "Unable to set schema db module config", err, nil)
		}
		if err := m.db.SetPreparedQueryConfig(ctx, project.DatabasePreparedQueries); err != nil {
			_ = helpers.Logger.LogError(helpers.GetRequestID(ctx), "Unable to set db prepared query module config", err, nil)
		}
		helpers.Logger.LogDebug(helpers.GetRequestID(ctx), "Setting config of schema module", nil)
		if err := m.schema.SetDatabaseSchema(project.DatabaseSchemas, projectID); err != nil {
			_ = helpers.Logger.LogError(helpers.GetRequestID(ctx), "Unable to set schema module config", err, nil)
		}
		helpers.Logger.LogDebug(helpers.GetRequestID(ctx), "Setting config of auth module", nil)
		if err := m.auth.SetConfig(ctx, project.FileStoreConfig.StoreType, project.ProjectConfig, project.DatabaseRules, project.DatabasePreparedQueries, project.FileStoreRules, project.RemoteService, project.EventingRules); err != nil {
			_ = helpers.Logger.LogError(helpers.GetRequestID(ctx), "Unable to set auth module config", err, nil)
		}
		helpers.Logger.LogDebug(helpers.GetRequestID(ctx), "Setting config of functions module", nil)
		if err := m.functions.SetConfig(projectID, project.RemoteService); err != nil {
			_ = helpers.Logger.LogError(helpers.GetRequestID(ctx), "Unable to set remote services module config", err, nil)
		}
		helpers.Logger.LogDebug(helpers.GetRequestID(ctx), "Setting config of user management module", nil)
		m.user.SetConfig(project.Auths)
		if err := m.user.SetProjectAESKey(project.ProjectConfig.AESKey); err != nil {
			_ = helpers.Logger.LogError(helpers.GetRequestID(ctx), "Unable to set aes key for user module config", err, nil)
		}
		helpers.Logger.LogDebug(helpers.GetRequestID(ctx), "Setting config of file storage module", nil)
		if err := m.file.SetConfig(projectID, project.FileStoreConfig); err != nil {
			_ = helpers.Logger.LogError(helpers.GetRequestID(ctx), "Unable to set filestore module config", err, nil)
		}
		helpers.Logger.LogDebug(helpers.GetRequestID(ctx), "Setting config of eventing module", nil)
		if err := m.eventing.SetConfig(projectID, project.EventingConfig); err != nil {
			_ = helpers.Logger.LogError(helpers.GetRequestID(ctx), "Unable to set eventing module config", err, nil)
		}
		helpers.Logger.LogDebug(helpers.GetRequestID(ctx), "Setting triggers of eventing module", nil)
		if err := m.eventing.SetTriggerConfig(project.EventingTriggers); err != nil {
			_ = helpers.Logger.LogError(helpers.GetRequestID(ctx), "Unable to set eventing module triggers", err, nil)
		}
		helpers.Logger.LogDebug(helpers.GetRequestID(ctx), "Setting config of realtime module", nil)
		if err := m.realtime.SetConfig(project.DatabaseConfigs, project.DatabaseRules, project.DatabaseSchemas); err != nil {
			_ = helpers.Logger.LogError(helpers.GetRequestID(ctx), "Unable to set realtime module config", err, nil)
		}
		if err := m.realtime.SetProjectAESKey(project.ProjectConfig.AESKey); err != nil {
			_ = helpers.Logger.LogError(helpers.GetRequestID(ctx), "Unable to set aes key for realtime module config", err, nil)
		}
		helpers.Logger.LogDebug(helpers.GetRequestID(ctx), "Setting config of graphql module", nil)
		m.graphql.SetConfig(projectID)
		if err := m.graphql.SetProjectAESKey(project.ProjectConfig.AESKey); err != nil {
			_ = helpers.Logger.LogError(helpers.GetRequestID(ctx), "Unable to set aes key for graphql module config", err, nil)
		}
		helpers.Logger.LogDebug(helpers.GetRequestID(ctx), "Setting config of lets encrypt module", nil)
		if err := m.GlobalMods.LetsEncrypt().SetProjectDomains(projectID, project.LetsEncrypt); err != nil {
			_ = helpers.Logger.LogError(helpers.GetRequestID(ctx), "Unable to set letsencypt module config", err, nil)
		}
		helpers.Logger.LogDebug(helpers.GetRequestID(ctx), "Setting config of ingress routing module", nil)
		if err := m.GlobalMods.Routing().SetProjectRoutes(projectID, project.IngressRoutes); err != nil {
			_ = helpers.Logger.LogError(helpers.GetRequestID(ctx), "Unable to set routing module config", err, nil)
		}
		m.GlobalMods.Routing().SetGlobalConfig(project.IngressGlobal)
		m.eventing.SetInternalTriggersFromDbRules(project.DatabaseRules)
		m.GlobalMods.Caching().AddDBRules(projectID, project.DatabaseRules)
	}
	return nil
}
func (m *Module) SetProjectConfig(ctx context.Context, p *config.ProjectConfig) error {
	helpers.Logger.LogDebug(helpers.GetRequestID(ctx), "Setting project config", nil)
	if err := m.auth.SetProjectConfig(p); err != nil {
		return err
	}
	_ = m.db.SetProjectAESKey(p.AESKey)
	_ = m.realtime.SetProjectAESKey(p.AESKey)
	_ = m.user.SetProjectAESKey(p.AESKey)
	_ = m.graphql.SetProjectAESKey(p.AESKey)
	m.graphql.SetConfig(p.ID)
	return nil
}
func (m *Module) SetDatabaseConfig(ctx context.Context, projectID string, databaseConfigs config.DatabaseConfigs, schemaConfigs config.DatabaseSchemas, ruleConfigs config.DatabaseRules, prepConfigs config.DatabasePreparedQueries) error {
	helpers.Logger.LogDebug(helpers.GetRequestID(ctx), "Setting config of db module", nil)
	if err := m.db.SetConfig(projectID, databaseConfigs); err != nil {
		return helpers.Logger.LogError(helpers.GetRequestID(ctx), "Unable to set db module config", err, nil)
	}
	helpers.Logger.LogDebug(helpers.GetRequestID(ctx), "Setting config of realtime module", nil)
	m.realtime.SetDatabaseConfig(databaseConfigs)
	if err := m.SetDatabaseSchemaConfig(ctx, projectID, schemaConfigs); err != nil {
		return err
	}
	if err := m.SetDatabaseRulesConfig(ctx, projectID, ruleConfigs); err != nil {
		return err
	}
	if err := m.SetDatabasePreparedQueryConfig(ctx, prepConfigs); err != nil {
		return err
	}
	return nil
}
func (m *Module) SetDatabaseSchemaConfig(ctx context.Context, projectID string, schemaConfigs config.DatabaseSchemas) error {
	helpers.Logger.LogDebug(helpers.GetRequestID(ctx), "Setting config of db schema in db module", nil)
	schemaDoc, err := schemaHelpers.Parser(schemaConfigs)
	if err != nil {
		return err
	}
	if err := m.db.SetSchemaConfig(ctx, schemaDoc, schemaConfigs); err != nil {
		return helpers.Logger.LogError(helpers.GetRequestID(ctx), "Unable to set db schema in db module", err, nil)
	}
	helpers.Logger.LogDebug(helpers.GetRequestID(ctx), "Setting config of schema module", nil)
	if err := m.schema.SetDatabaseSchema(schemaConfigs, projectID); err != nil {
		return err
	}
	m.realtime.SetDatabaseSchemas(schemaConfigs)
	return nil
}
func (m *Module) SetDatabaseRulesConfig(ctx context.Context, projectID string, ruleConfigs config.DatabaseRules) error {
	helpers.Logger.LogDebug(helpers.GetRequestID(ctx), "Setting config of db rule in db module", nil)
	m.auth.SetDatabaseRules(ruleConfigs)
	m.realtime.SetDatabaseRules(ruleConfigs)
	m.eventing.SetInternalTriggersFromDbRules(ruleConfigs)
	m.GlobalMods.Caching().AddDBRules(projectID, ruleConfigs)
	return nil
}
func (m *Module) SetDatabasePreparedQueryConfig(ctx context.Context, prepConfigs config.DatabasePreparedQueries) error {
	helpers.Logger.LogDebug(helpers.GetRequestID(ctx), "Setting config of db prepared query in db module", nil)
	if err := m.db.SetPreparedQueryConfig(ctx, prepConfigs); err != nil {
		return helpers.Logger.LogError(helpers.GetRequestID(ctx), "Unable to set db prepared query in db module", err, nil)
	}
	m.auth.SetDatabasePreparedQueryRules(prepConfigs)
	return nil
}
func (m *Module) SetFileStoreConfig(ctx context.Context, projectID string, fileStore *config.FileStoreConfig) error {
	helpers.Logger.LogDebug(helpers.GetRequestID(ctx), "Setting config of file storage module", nil)
	if err := m.file.SetConfig(projectID, fileStore); err != nil {
		return helpers.Logger.LogError(helpers.GetRequestID(ctx), "Unable to set filestore module config", err, nil)
	}
	m.auth.SetFileStoreType(fileStore.StoreType)
	return nil
}
func (m *Module) SetFileStoreSecurityRuleConfig(ctx context.Context, _ string, fileStoreRules config.FileStoreRules) {
	helpers.Logger.LogDebug(helpers.GetRequestID(ctx), "Setting config of file store rules in auth module", nil)
	m.auth.SetFileStoreRules(fileStoreRules)
}
func (m *Module) SetEventingConfig(ctx context.Context, projectID string, eventingConfig *config.EventingConfig, secureObj config.EventingRules, eventingSchemas config.EventingSchemas, eventingTriggers config.EventingTriggers) error {
	helpers.Logger.LogDebug(helpers.GetRequestID(ctx), "Setting config of eventing module", nil)
	if err := m.eventing.SetConfig(projectID, eventingConfig); err != nil {
		return helpers.Logger.LogError(helpers.GetRequestID(ctx), "Unable to set eventing module config", err, nil)
	}
	if err := m.SetEventingSchemaConfig(ctx, eventingSchemas); err != nil {
		return err
	}
	if err := m.SetEventingRuleConfig(ctx, secureObj); err != nil {
		return err
	}
	if err := m.SetEventingTriggerConfig(ctx, eventingTriggers); err != nil {
		return err
	}
	return nil
}