This is an automated email from the git hooks/post-receive script. jame-guest pushed a commit to tag v0.08 in repository libweasel-perl.
commit f75f1819db317988f9b1c8fd84f7e660f278e9b6 Author: Yves Lavoie <[email protected]> Date: Fri Aug 26 14:16:17 2016 -0400 Add the possibility to use an environment variable for base_url --- lib/Weasel/Session.pm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/Weasel/Session.pm b/lib/Weasel/Session.pm index af700fb..9878068 100644 --- a/lib/Weasel/Session.pm +++ b/lib/Weasel/Session.pm @@ -73,6 +73,9 @@ has 'widget_groups' => (is => 'rw'); Holds the prefix that will be prepended to every URL passed to this API. +The prefix can be an environment variable, e.g. ${VARIABLE}. +It will be expanded and default to hppt://localhost:5000 if not defined. +If it is not an environment variable, it will be used as is. =cut @@ -223,7 +226,10 @@ after prefixing with C<base_url>. sub get { my ($self, $url) = @_; - $url = $self->base_url . $url; + my $base = $self->base_url =~ /\$\{([a-zA-Z0-9_]+)\}/ + ? $ENV{$1} // "http://localhost:5000" + : $self->base_url; + $url = $base . $url; ###TODO add logging warning of urls without protocol part # which might indicate empty 'base_url' where one is assumed to be set $self->driver->get($url); -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libweasel-perl.git _______________________________________________ Pkg-perl-cvs-commits mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits
