Reindent code
[app-fonbot-daemon.git] / lib / App / FonBot / Plugin / Config.pm
CommitLineData
8dc70d07
MG
1package App::FonBot::Plugin::Config;
2
3our $VERSION = '0.000_3';
4
5use v5.14;
6use strict;
7use warnings;
8
9use parent qw/Exporter/;
10
11use Apache2::Authen::Passphrase;
12use Log::Log4perl qw//;
13
14our @EXPORT_OK=qw/$oftc_enabled $oftc_nick @oftc_channels $oftc_nickserv_password $bitlbee_enabled $bitlbee_nick $bitlbee_server $bitlbee_port $bitlbee_password $dir $user $group @supplementary_groups $httpd_port/;
15
16##################################################
17
18our ($oftc_enabled, $oftc_nick, @oftc_channels, $oftc_nickserv_password);
19our ($bitlbee_enabled, $bitlbee_nick, $bitlbee_server, $bitlbee_port, $bitlbee_password);
20our ($dir, $user, $group, @supplementary_groups);
21
22##################################################
23
24my $log=Log::Log4perl->get_logger(__PACKAGE__);
25
26sub init{
962dff7b
MG
27 $log->info('reading config file');
28 unless (my $ret = do '/etc/fonbotd/config.pl') {
29 die "Cannot parse config file: $@" if $@;
30 die "Cannot run config file: $!" unless $ret;
31 }
8dc70d07
MG
32}
33
34sub fini{
962dff7b 35 #no-op
8dc70d07
MG
36}
37
381;
39
40__END__
41
42=encoding utf-8
43
44=head1 NAME
45
46App::FonBot::Plugin::Config - FonBot plugin for reading configuration files
47
48=head1 SYNOPSIS
49
962dff7b
MG
50 use App::FonBot::Plugin::Config qw/$oftc_enabled $oftc_nick @oftc_channels $oftc_nickserv_password $bitlbee_enabled $bitlbee_nick $bitlbee_server $bitlbee_port $bitlbee_password $user $group @supplementary_groups $httpd_port/;
51 App::FonBot::Plugin::Config->init;
52
53 # Variables used in App::FonBot:Plugin::OFTC
54 say "The OFTC plugin is ".($oftc_enabled ? 'enabled' : 'disabled');
55 say "The OFTC NickServ password is $oftc_nickserv_password";
56 say "The OFTC nickname is $oftc_nick";
57 say "The OFTC channels are @oftc_channels";
58
59 # Variables used in App::FonBot::Plugin::BitlBee
60 say "The BitlBee plugin is ".($bitlbee_enabled ? 'enabled' : 'disabled');
61 say "The BitlBee server runs on port $bitlbee_port of host $bitlbee_server"
62 say "The BitlBee nickname is $bitlbee_nick";
63 say "The BitlBee password is $bitlbee_password";
64
65 # Variables used in App::FonBot::Plugin::Common
66 say "The storage directory is $dir";
67 say "The user is $user";
68 say "The primary group is $group";
69 say "The supplementary groups are @supplementary_groups";
70
71 # Variables used in App::FonBot::Plugin::HTTPD
72 say "The HTTPD listens on port $httpd_port"
8dc70d07
MG
73
74=head1 DESCRIPTION
75
76This FonBot plugin reads a configuration file (hardcoded to F</etc/fonbot/config.pl>) and provides configuration variables to the other plugins. It is a required plugin, since all other plugins depend on it.
77
78The configuration variables are described in detail in the plugins that use it.
79
80=head1 METHODS
81
82=over
83
84=item C<App::FonBot::Plugin::Config-E<gt>init>
85
86(Re-)reads the configuration file, populating the configuration variables. The configuration file is a regular perl script, hardcoded to F</etc/fonbot/config.pl>.
87
88=item C<App::FonBot::Plugin::Config-E<gt>fini>
89
90Currently a no-op. It is recommended to call this after finishing using this module, since it might do something in a future release.
91
92=back
93
94=head1 AUTHOR
95
96Marius Gavrilescu C<< <marius@ieval.ro> >>
97
98=head1 COPYRIGHT AND LICENSE
99
100Copyright 2013 Marius Gavrilescu
101
102This file is part of fonbotd.
103
104fonbotd is free software: you can redistribute it and/or modify
105it under the terms of the GNU Affero General Public License as published by
106the Free Software Foundation, either version 3 of the License, or
107(at your option) any later version.
108
109fonbotd is distributed in the hope that it will be useful,
110but WITHOUT ANY WARRANTY; without even the implied warranty of
111MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
112GNU Affero General Public License for more details.
113
114You should have received a copy of the GNU Affero General Public License
115along with fonbotd. If not, see <http://www.gnu.org/licenses/>
116
117
118=cut
This page took 0.016865 seconds and 4 git commands to generate.