@@ -216,29 +216,10 @@ func (r *Runner) Run(ctx context.Context) error {
216
216
return err
217
217
}
218
218
219
- if len (* configText ) != 0 || len (* configFile ) != 0 {
220
- theConfig , err := loader .LoadConfig ([]byte (* configText ), * configFile )
221
- if err != nil {
222
- setupLog .Error (err , "Failed to load the configuration" )
223
- return err
224
- }
225
-
226
- epp := newEppHandle ()
227
-
228
- err = loader .LoadPluginReferences (theConfig .Plugins , epp )
229
- if err != nil {
230
- setupLog .Error (err , "Failed to instantiate the plugins" )
231
- return err
232
- }
233
-
234
- r .schedulerConfig , err = loader .LoadSchedulerConfig (theConfig .SchedulingProfiles , epp )
235
- if err != nil {
236
- setupLog .Error (err , "Failed to create Scheduler configuration" )
237
- return err
238
- }
239
-
240
- // Add requestControl plugins
241
- r .requestControlConfig .AddPlugins (epp .Plugins ().GetAllPlugins ()... )
219
+ err = r .parseConfiguration ()
220
+ if err != nil {
221
+ setupLog .Error (err , "Failed to parse the configuration" )
222
+ return err
242
223
}
243
224
244
225
// --- Initialize Core EPP Components ---
@@ -328,6 +309,31 @@ func (r *Runner) initializeScheduler() (*scheduling.Scheduler, error) {
328
309
return scheduler , nil
329
310
}
330
311
312
+ func (r * Runner ) parseConfiguration () error {
313
+ if len (* configText ) != 0 || len (* configFile ) != 0 {
314
+ theConfig , err := loader .LoadConfig ([]byte (* configText ), * configFile )
315
+ if err != nil {
316
+ return fmt .Errorf ("failed to load the configuration - %w" , err )
317
+ }
318
+
319
+ epp := newEppHandle ()
320
+
321
+ err = loader .LoadPluginReferences (theConfig .Plugins , epp )
322
+ if err != nil {
323
+ return fmt .Errorf ("failed to instantiate the plugins - %w" , err )
324
+ }
325
+
326
+ r .schedulerConfig , err = loader .LoadSchedulerConfig (theConfig .SchedulingProfiles , epp )
327
+ if err != nil {
328
+ return fmt .Errorf ("failed to create Scheduler configuration - %w" , err )
329
+ }
330
+
331
+ // Add requestControl plugins
332
+ r .requestControlConfig .AddPlugins (epp .Plugins ().GetAllPlugins ()... )
333
+ }
334
+ return nil
335
+ }
336
+
331
337
func initLogging (opts * zap.Options ) {
332
338
// Unless -zap-log-level is explicitly set, use -v
333
339
useV := true
0 commit comments