@@ -216,29 +216,10 @@ func (r *Runner) Run(ctx context.Context) error {
216216 return err
217217 }
218218
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
242223 }
243224
244225 // --- Initialize Core EPP Components ---
@@ -328,6 +309,31 @@ func (r *Runner) initializeScheduler() (*scheduling.Scheduler, error) {
328309 return scheduler , nil
329310}
330311
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+
331337func initLogging (opts * zap.Options ) {
332338 // Unless -zap-log-level is explicitly set, use -v
333339 useV := true
0 commit comments