Allow OverConf to pass module params

This commit is contained in:
Maxime Besson 2022-10-10 16:16:54 +02:00
parent c54b89485e
commit 0d4bea66ed
6 changed files with 6 additions and 13 deletions

View File

@ -116,13 +116,12 @@ sub init {
my $moduleType = $self->conf->{sfExtra}->{$extraKey}->{type};
next unless ($moduleType);
my $over = $self->conf->{sfExtra}->{$extraKey}->{over};
my %over = %{ $self->conf->{sfExtra}->{$extraKey}->{over} or {} };
$self->logger->debug(
"Loading extra 2F module $extraKey of type $moduleType");
my $m =
$self->loadPlugin( "::2F::$moduleType",
{ sfPrefix => $extraKey, %over } )
$self->loadPlugin( "::2F::$moduleType", $over, prefix => $extraKey, )
or return 0;
# Rule and prefix may be modified by 2F module, reread them

View File

@ -43,7 +43,6 @@ sub init {
}
}
$self->prefix( $self->conf->{sfPrefix} ) if ( $self->conf->{sfPrefix} );
return $self->SUPER::init();
}

View File

@ -68,8 +68,6 @@ sub init {
return 0;
}
$self->prefix( $self->conf->{sfPrefix} )
if ( $self->conf->{sfPrefix} );
return $self->SUPER::init();
}

View File

@ -66,7 +66,6 @@ sub init {
$self->vrfyAttrs->{$k} = $attr;
}
$self->prefix( $self->conf->{sfPrefix} ) if ( $self->conf->{sfPrefix} );
return $self->SUPER::init();
}

View File

@ -46,8 +46,6 @@ sub init {
)
);
$self->prefix( $self->conf->{sfPrefix} )
if ( $self->conf->{sfPrefix} );
return $self->SUPER::init();
}

View File

@ -8,15 +8,15 @@ our @overC;
# Override portal loadPlugin() to use a wrapped configuration
sub loadPlugin {
my ( $self, $plugin, $over ) = @_;
my $obj = $self->loadModule( $plugin, $over );
my ( $self, $plugin, $over, %args ) = @_;
my $obj = $self->loadModule( $plugin, $over, %args );
return 0
unless ( $obj and $obj = $self->p->findEP( $plugin, $obj ) );
return $obj;
}
sub loadModule {
my ( $self, $plugin, $over ) = @_;
my ( $self, $plugin, $over, %args ) = @_;
my $obj;
my $nc;
if ($over) {
@ -28,7 +28,7 @@ sub loadModule {
$nc = $self->conf;
}
return 0
unless ( $obj = $self->p->loadModule( "$plugin", $nc ) );
unless ( $obj = $self->p->loadModule( "$plugin", $nc, %args ) );
return $obj;
}