Skip to content

Commit

Permalink
add a script restriction for forcing setting ES_SCRIPT_INDEX when usi…
Browse files Browse the repository at this point in the history
…ng alternative index
  • Loading branch information
mickeyn committed Nov 17, 2016
1 parent f4523e0 commit 8d6e042
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/MetaCPAN/Role/Script.pm
Expand Up @@ -98,6 +98,20 @@ has queue => (
documentation => 'add indexing jobs to the minion queue',
);

sub BUILDARGS {
my ( $self, @args ) = @_;
my %args = @args == 1 ? %{ $args[0] } : @args;

if ( exists $args{'index'} ) {
die
"when setting --index, please export ES_SCRIPT_INDEX to the same value\n"
unless $ENV{'ES_SCRIPT_INDEX'}
and $args{'index'} eq $ENV{'ES_SCRIPT_INDEX'};
}

return \%args;
}

sub handle_error {
my ( $self, $error ) = @_;

Expand Down

0 comments on commit 8d6e042

Please sign in to comment.