| 1 | # $Id: Config.pm.in 1431 2003-10-17 11:48:27Z richardc $ | ||||||||||
| 2 | package Siesta::Config; | ||||||||||
| 3 | 27 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 27 | ▶ | use vars qw( $CONFIG_FILE $ROOT $MESSAGES @STORAGE $ARCHIVE $LOG_PATH $LOG_LEVEL $config ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 27 | ▶ | use AppConfig qw(:expand :argcount); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | =head1 NAME | ||||||||||
| 8 | |||||||||||
| 9 | Siesta::Config - organise the configuration of a Siesta install | ||||||||||
| 10 | |||||||||||
| 11 | =head1 VARIABLES | ||||||||||
| 12 | |||||||||||
| 13 | =head2 C<$ROOT> | ||||||||||
| 14 | |||||||||||
| 15 | Where to install everything to. Currently this is set to | ||||||||||
| 16 | |||||||||||
| 17 | /usr/local/siesta | ||||||||||
| 18 | |||||||||||
| 19 | =head2 C<$CONFIG_FILE> | ||||||||||
| 20 | |||||||||||
| 21 | Where the config file is currently | ||||||||||
| 22 | |||||||||||
| 23 | /usr/local/siesta/siesta.conf | ||||||||||
| 24 | |||||||||||
| 25 | This can be overridden when using the command line tools by | ||||||||||
| 26 | using | ||||||||||
| 27 | |||||||||||
| 28 | -f <new config file> | ||||||||||
| 29 | |||||||||||
| 30 | |||||||||||
| 31 | =head3 CONFIG OPTIONS | ||||||||||
| 32 | |||||||||||
| 33 | The following options are set within the config file : | ||||||||||
| 34 | |||||||||||
| 35 | =over 4 | ||||||||||
| 36 | |||||||||||
| 37 | =item root | ||||||||||
| 38 | |||||||||||
| 39 | override the C<$ROOT> variable above | ||||||||||
| 40 | |||||||||||
| 41 | =item messages | ||||||||||
| 42 | |||||||||||
| 43 | Where our message templates are stored. | ||||||||||
| 44 | |||||||||||
| 45 | By default - /usr/local/siesta/messages/ | ||||||||||
| 46 | |||||||||||
| 47 | =item archive | ||||||||||
| 48 | |||||||||||
| 49 | Where we archive list mails. | ||||||||||
| 50 | |||||||||||
| 51 | By default - /usr/local/siesta/archive/<list name>/ | ||||||||||
| 52 | |||||||||||
| 53 | =item log_path | ||||||||||
| 54 | |||||||||||
| 55 | Where we log things | ||||||||||
| 56 | |||||||||||
| 57 | By default - /usr/local/siesta/error | ||||||||||
| 58 | |||||||||||
| 59 | |||||||||||
| 60 | =item log_level | ||||||||||
| 61 | |||||||||||
| 62 | By default - 3 | ||||||||||
| 63 | |||||||||||
| 64 | =item storage_dsn | ||||||||||
| 65 | |||||||||||
| 66 | The DSN for our local DB | ||||||||||
| 67 | |||||||||||
| 68 | By default - dbi:SQLite:/usr/local/siesta/database | ||||||||||
| 69 | |||||||||||
| 70 | =item storage_user | ||||||||||
| 71 | |||||||||||
| 72 | The user name for our DB | ||||||||||
| 73 | |||||||||||
| 74 | By default - root | ||||||||||
| 75 | |||||||||||
| 76 | =item storage_pass | ||||||||||
| 77 | |||||||||||
| 78 | The password for our DB | ||||||||||
| 79 | |||||||||||
| 80 | By default - undef | ||||||||||
| 81 | |||||||||||
| 82 | =back | ||||||||||
| 83 | |||||||||||
| 84 | =head2 C<@STORAGE> | ||||||||||
| 85 | |||||||||||
| 86 | A list containing the dsn, the user and password. | ||||||||||
| 87 | |||||||||||
| 88 | =head1 CREATION | ||||||||||
| 89 | |||||||||||
| 90 | This file is autogenerated from Config.pm.in when you run Build.PL | ||||||||||
| 91 | |||||||||||
| 92 | =cut | ||||||||||
| 93 | |||||||||||
| 94 | |||||||||||
| 95 | 36 | ▶ | sub load_from { | ||||||||
|
Subroutine
load_from: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||
| 96 | 36 | shift; | |||||||||
| 97 | 36 | my $file = shift; | |||||||||
| 98 | 36 | ▶ | $config->file($file) if -e $file; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 99 | |||||||||||
| 100 | 36 | @STORAGE = ($config->get('storage_dsn'), | |||||||||
| 101 | $config->get('storage_user'), | ||||||||||
| 102 | $config->get('storage_pass')), | ||||||||||
| 103 | $MESSAGES = $config->get('messages'); | ||||||||||
| 104 | 36 | $ARCHIVE = $config->get('archive'); | |||||||||
| 105 | 36 | $LOG_PATH = $config->get('log_path'); | |||||||||
| 106 | 36 | $LOG_LEVEL = $config->get('log_level'); | |||||||||
| 107 | } | ||||||||||
| 108 | |||||||||||
| 109 | |||||||||||
| 110 | 27 | ▶ | BEGIN { | ||||||||
|
Subroutine
BEGIN: called CC=2 SCAR=7.0
| |||||||||||
| 111 | 27 | $ROOT = '/usr/local/siesta'; | |||||||||
| 112 | 27 | ▶ | $CONFIG_FILE = '/usr/local/siesta/siesta.conf' unless defined $CONFIG_FILE; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 113 | |||||||||||
| 114 | 27 | $config = AppConfig->new({ | |||||||||
| 115 | GLOBAL => { ARGCOUNT => ARGCOUNT_ONE, | ||||||||||
| 116 | EXPAND => EXPAND_ALL, | ||||||||||
| 117 | }, | ||||||||||
| 118 | }, | ||||||||||
| 119 | |||||||||||
| 120 | root => { | ||||||||||
| 121 | DEFAULT => '/usr/local/siesta', | ||||||||||
| 122 | }, | ||||||||||
| 123 | messages => { | ||||||||||
| 124 | DEFAULT => '/usr/local/siesta/messages', | ||||||||||
| 125 | }, | ||||||||||
| 126 | archive => { | ||||||||||
| 127 | DEFAULT => '/usr/local/siesta/archive', | ||||||||||
| 128 | }, | ||||||||||
| 129 | log_path => { | ||||||||||
| 130 | DEFAULT => '/usr/local/siesta/error', | ||||||||||
| 131 | }, | ||||||||||
| 132 | log_level => { | ||||||||||
| 133 | DEFAULT => 3, | ||||||||||
| 134 | }, | ||||||||||
| 135 | storage_dsn => { | ||||||||||
| 136 | DEFAULT => 'dbi:SQLite:/usr/local/siesta/database', | ||||||||||
| 137 | }, | ||||||||||
| 138 | storage_user => { | ||||||||||
| 139 | DEFAULT => 'root', | ||||||||||
| 140 | }, | ||||||||||
| 141 | storage_pass => { | ||||||||||
| 142 | DEFAULT => undef, | ||||||||||
| 143 | }, | ||||||||||
| 144 | ); | ||||||||||
| 145 | 27 | __PACKAGE__->load_from( $CONFIG_FILE ); | |||||||||
| 146 | } | ||||||||||
| 147 | |||||||||||
| 148 | 27 | 1; | |||||||||