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