Changeset 31490 for gs3-extensions/solr/trunk/src/perllib/solrserver.pm
- Timestamp:
- 2017-03-10T22:03:47+13:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gs3-extensions/solr/trunk/src/perllib/solrserver.pm
r30534 r31490 43 43 $self->{'server_explicitly_started'} = undef; 44 44 45 my $server_port = $ENV{'SOLR_PORT'}; 46 my $server_host = $ENV{'SOLR_HOST'}; 47 my $base_url = "http://$server_host:$server_port/solr/"; 48 my $admin_url = "http://$server_host:$server_port/solr/admin/cores"; 49 50 $self->{'base-url'} = $base_url; 51 $self->{'admin-url'} = $admin_url; 45 # set SOLR_HOST and SOLR_PORT env vars (tomcat host and port, if not using jetty) 46 # by calling ant get-default-solr-servlet if possible. Else fallback on whatever the existing env vars are. 47 # tomcat host and port would have been set up in the env as SOLR_HOST and SOLR_PORT 48 # In case someone changed the tomcat host/port, we want to update the solr server variables too 49 my $solr_url = &solrutil::get_solr_servlet_url(); 50 # get the url parts, though we won't be using most of them 51 my ($protocol, $server_host, $server_port, $servlet_name) = &solrutil::get_solr_url_parts($solr_url); 52 53 # set the solr server env vars to what was discovered, so that any other old perl code 54 # dependent on these env vars will have any changes propagated. 55 # (All perl code referencing these env vars should already be updated, but still...) 56 $ENV{'SOLR_HOST'} = $server_host; 57 $ENV{'SOLR_PORT'} = $server_port; 58 59 $self->{'base-url'} = $solr_url; # e.g. of the form http://localhost:8383/solr 60 $self->{'admin-url'} = "$solr_url/admin/cores"; 52 61 53 62 return bless $self, $class; 63 } 64 65 sub get_solr_base_url { 66 my $self = shift (@_); 67 return $self->{'base-url'}; 54 68 } 55 69
Note:
See TracChangeset
for help on using the changeset viewer.