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