Skip to content

Commit 7a94c34

Browse files
committed
pr feedback
1 parent a662ad7 commit 7a94c34

File tree

2 files changed

+5
-13
lines changed

2 files changed

+5
-13
lines changed

internal/resource/resource_service.go

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -194,12 +194,12 @@ func (r *ResourceService) ApplyConfig(ctx context.Context, instanceID string) (*
194194
}
195195
}
196196

197-
configContext, parseErr := r.ParseConfig(ctx, instance)
198-
if parseErr != nil || configContext == nil {
197+
nginxConfigContext, parseErr := r.nginxConfigParser.Parse(ctx, instance)
198+
if parseErr != nil || nginxConfigContext == nil {
199199
return nil, fmt.Errorf("failed to parse config %w", parseErr)
200200
}
201201

202-
datasource.UpdateNginxInstanceRuntime(instance, configContext)
202+
datasource.UpdateNginxInstanceRuntime(instance, nginxConfigContext)
203203

204204
slog.DebugContext(ctx, "Updated Instance Runtime after parsing config", "instance", instance.GetInstanceRuntime())
205205

@@ -213,22 +213,14 @@ func (r *ResourceService) ApplyConfig(ctx context.Context, instanceID string) (*
213213
return nil, fmt.Errorf("failed to reload NGINX %w", reloadErr)
214214
}
215215

216-
return configContext, nil
216+
return nginxConfigContext, nil
217217
}
218218

219219
func (r *ResourceService) ParseConfig(ctx context.Context, instance *mpi.Instance) (*model.NginxConfigContext, error) {
220220
slog.DebugContext(ctx, "Parsing NGINX instance config", "instance_id", instance.GetInstanceMeta().GetInstanceId())
221221

222222
nginxConfigContext, parseErr := r.nginxConfigParser.Parse(ctx, instance)
223223
if parseErr != nil {
224-
slog.WarnContext(
225-
ctx,
226-
"Unable to parse NGINX instance config",
227-
"config_path", instance.GetInstanceRuntime().GetConfigPath(),
228-
"instance_id", instance.GetInstanceMeta().GetInstanceId(),
229-
"error", parseErr,
230-
)
231-
232224
return nil, parseErr
233225
}
234226

internal/watcher/watcher_plugin.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ func (*Watcher) Subscriptions() []string {
158158
}
159159

160160
func (w *Watcher) handleConfigApplyRequest(ctx context.Context, msg *bus.Message) {
161-
slog.Info("Received ConfigApplyRequest event")
161+
slog.Info("Watcher plugin received ConfigApplyRequest event")
162162
managementPlaneRequest, ok := msg.Data.(*mpi.ManagementPlaneRequest)
163163
if !ok {
164164
slog.ErrorContext(ctx, "Unable to cast message payload to *mpi.ManagementPlaneRequest",

0 commit comments

Comments
 (0)