diff options
Diffstat (limited to 'web/api/public/config')
-rwxr-xr-x | web/api/public/config | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/web/api/public/config b/web/api/public/config new file mode 100755 index 0000000..dd8ccc1 --- /dev/null +++ b/web/api/public/config @@ -0,0 +1,28 @@ +#! /usr/bin/perl +# vim:ts=8:sw=8 + +use DBI; +use lib '/opt/gondul/include'; +use nms; +use nms::web; +use strict; +use warnings; +use Data::Dumper; + +$nms::web::cc{'max-age'} = "3600"; + +my $hostname = $ENV{'HTTP_HOST'} || ""; +my $q2 = $nms::web::dbh->prepare('select id, publicvhost, shortname, data from config order by id desc limit 1;'); + +$q2->execute(); +while (my $ref = $q2->fetchrow_hashref()) { + $nms::web::json{'config'} = $ref; + $nms::web::json{'config'}{'data'} = JSON::XS::decode_json($ref->{'data'}); + if ($ref->{'publicvhost'} eq $hostname) { + $nms::web::json{'config'}{'public'} = "true"; + } else { + $nms::web::json{'config'}{'public'} = "false"; + } +} + +finalize_output(); |