fix: PR changes

This commit is contained in:
sidwebworks
2025-08-14 21:43:49 +05:30
parent f2a9a57c95
commit 13aa380cac
8 changed files with 145 additions and 82 deletions
+8 -8
View File
@@ -207,19 +207,19 @@ type GetProjectByIDResponse struct {
Project model.Project `json:"workspace"`
}
type SubProjectEventsRequestRegister struct {
Event string `json:"event"`
Conditions *SubProjectEventsRequestCondition `json:"conditions"`
type SubscribeProjectEventsRequestRegister struct {
Event string `json:"event"`
Conditions *SubscribeProjectEventsRequestCondition `json:"conditions"`
}
type SubProjectEventsRequestCondition struct {
type SubscribeProjectEventsRequestCondition struct {
EnvironmentSlug string `json:"environmentSlug"`
SecretPath string `json:"secretPath"`
}
type SubProjectEventsRequest struct {
ProjectID string `json:"projectId"`
Register []SubProjectEventsRequestRegister `json:"register"`
type SubscribeProjectEventsRequest struct {
ProjectID string `json:"projectId"`
Register []SubscribeProjectEventsRequestRegister `json:"register"`
}
type SubProjectEventsResponse struct{}
type SubscribeProjectEventsResponse struct{}
@@ -79,8 +79,6 @@ func (r *InfisicalSecretReconciler) GetLogger(req ctrl.Request) logr.Logger {
func (r *InfisicalSecretReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
logger := r.GetLogger(req)
logger.Info("Reconcile called")
var infisicalSecretCRD secretsv1alpha1.InfisicalSecret
requeueTime := time.Minute // seconds
@@ -567,7 +567,7 @@ func (r *InfisicalSecretReconciler) OpenInstantUpdatesStream(ctx context.Context
envSlug := variables.AuthDetails.MachineIdentityScope.EnvSlug
infiscalClient := variables.InfisicalClient
conn := variables.ServerSentEvents
sseRegistry := variables.ServerSentEvents
token := infiscalClient.Auth().GetAccessToken()
@@ -581,14 +581,14 @@ func (r *InfisicalSecretReconciler) OpenInstantUpdatesStream(ctx context.Context
secretsPath = fmt.Sprint(secretsPath, "**")
}
conditions := &api.SubProjectEventsRequestCondition{
conditions := &api.SubscribeProjectEventsRequestCondition{
SecretPath: secretsPath,
EnvironmentSlug: envSlug,
}
body, err := json.Marshal(api.SubProjectEventsRequest{
body, err := json.Marshal(api.SubscribeProjectEventsRequest{
ProjectID: project.ID,
Register: []api.SubProjectEventsRequestRegister{
Register: []api.SubscribeProjectEventsRequestRegister{
{
Event: "secret:create",
Conditions: conditions,
@@ -612,7 +612,7 @@ func (r *InfisicalSecretReconciler) OpenInstantUpdatesStream(ctx context.Context
return fmt.Errorf("CallSubscribeProjectEvents: unable to marshal body [err=%s]", err)
}
events, errors, err := conn.Subscribe(func() (*http.Request, error) {
events, errors, err := sseRegistry.Subscribe(func() (*http.Request, error) {
headers := map[string]string{
"User-Agent": api.USER_AGENT_NAME,
"Authorization": fmt.Sprint("Bearer ", token),