Added the ability to specify an optional host address for the built-in HTTP server to bind to. [#19]

This commit is contained in:
Jordi Sanfeliu 2013-05-17 11:57:48 +02:00
parent b845671dc5
commit 6336029499
4 changed files with 17 additions and 3 deletions

View File

@ -4,8 +4,10 @@
graph. Now the values shown are more real and accurate.
- Added user/password authentication option in the built-in HTTP server. [#14]
- Added the script 'htpasswd.pl' to be able to encrypt passwords. [#14]
- Added the ability to specify an optional host address for the built-in HTTP
server to bind to. [#19]
- Fixed a bug that prevented seeing the Core temperatures in the 'lmsens' graph.
(thanks to Bryan Guidroz, bryanguidroz AT hotmail.com for pointing this out)
(thanks to Bryan Guidroz, bryanguidroz AT hotmail.com)
3.2.0 - 13-May-2013

View File

@ -24,6 +24,7 @@ use strict;
use warnings;
use Exporter 'import';
use POSIX qw(setuid setgid setsid);
use Socket;
our @EXPORT = qw(logger trim min max celsius_to httpd_setup get_nvidia_data get_ati_data flush_accounting_rules);
sub logger {
@ -76,6 +77,7 @@ sub httpd_setup {
my (undef, undef, $uid) = getpwnam($config->{httpd_builtin}->{user});
my (undef, undef, $gid) = getgrnam($config->{httpd_builtin}->{group});
my $host = $config->{httpd_builtin}->{host};
my $port = $config->{httpd_builtin}->{port};
if(!defined($uid)) {
@ -115,7 +117,9 @@ sub httpd_setup {
}
}
my $server = HTTPServer->new($port);
my $server = HTTPServer->new();
$server->host($host);
$server->port($port);
$server->run();
exit(0);
}

View File

@ -32,7 +32,7 @@ Default value: \fIPlace a Title Here\fP
.RS
The name of the host.
.P
Default value: none
Default value:
.RE
.P
.BI theme_color
@ -159,6 +159,13 @@ This enables or disables the HTTP server that Monitorix has built-in. This is sp
Default value: \fIy\fP
.RE
.P
.BI host
.RS
This option takes an optional host address for this server to bind to. If none is specified (default) it will bind to all interfaces.
.P
Default value:
.RE
.P
.BI port
.RS
This is the network port from where the HTTP server will listen on.

View File

@ -20,6 +20,7 @@ base_cgi = /monitorix-cgi
<httpd_builtin>
enabled = y
host =
port = 8080
user = nobody
group = nobody