Rex
view release on metacpan or search on metacpan
lib/Rex/Config.pm view on Meta::CPAN
/bin
/sbin
/usr/bin
/usr/sbin
/usr/local/bin
/usr/local/sbin
/usr/pkg/bin
/usr/pkg/sbin
);
}
return @{$path};
}
=head2 set_user
=head2 get_user
Sets and gets the value of the C<$user> configuration variable, which also can be set via the C<REX_USER> environment variable.
This controls which L<user|Rex::Commands#user> Rex should use for authentication.
Default is determined by the following logic:
=over 4
=item * value of C<REX_USER> environment variable
=item * user set by L<user|Rex::Commands#user> command
=item * user running Rex
=back
=cut
sub set_user {
my $class = shift;
$user = shift;
}
sub has_user {
my $class = shift;
return $user;
}
sub get_user {
my $class = shift;
if ( exists $ENV{REX_USER} ) {
return $ENV{REX_USER};
}
if ($user) {
return $user;
}
if ( $^O =~ m/^MSWin/ ) {
return getlogin;
}
else {
return scalar getpwuid($<);
}
}
=head2 set_password
=head2 get_password
Sets and gets the value of the C<$password> configuration variable, which also can be set via the C<REX_PASSWORD> environment variable.
This controls what L<password|Rex::Commands#password> Rex should use for authentication or as passphrase when using private keys.
Default is C<undef>.
=cut
sub set_password {
my $class = shift;
$password = shift;
}
sub get_password {
my $class = shift;
if ( exists $ENV{REX_PASSWORD} ) {
return $ENV{REX_PASSWORD};
}
return $password;
}
=head2 set_port
=head2 get_port
Sets and gets the value of the C<$port> configuration variable.
This controls which L<port|Rex::Commands#port> Rex should connect to.
C<get_port> accepts an optional C<< server => $server >> argument to return the C<port> setting for the given C<$server> as optionally set in group files.
Default is C<undef>.
=cut
sub set_port {
my $class = shift;
$port = shift;
}
sub get_port {
my $class = shift;
my $param = {@_};
if ( exists $param->{server}
&& exists $SSH_CONFIG_FOR{ $param->{server} }
&& exists $SSH_CONFIG_FOR{ $param->{server} }->{port} )
{
return $SSH_CONFIG_FOR{ $param->{server} }->{port};
}
( run in 0.691 second using v1.01-cache-2.11-cpan-39bf76dae61 )