X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2FConf.pm;h=645dbf1c452a325f644321810df5ebd2ba17b0e0;hb=f1038a648b3d53db925b23519e7cd2a30c6837ed;hp=5dba387feb15a1f727b8e7e263a68be1dc878c02;hpb=56ef0a8a658b8449d1125fe017b21e0c636a8b0c;p=freeside.git diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index 5dba387fe..645dbf1c4 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -2,6 +2,7 @@ package FS::Conf; use vars qw($default_dir @config_items $DEBUG ); use IO::File; +use File::Basename; use FS::ConfItem; $DEBUG = 0; @@ -25,6 +26,10 @@ FS::Conf - Freeside configuration values @list = $conf->config('key'); $bool = $conf->exists('key'); + $conf->touch('key'); + $conf->set('key' => 'value'); + $conf->delete('key'); + @config_items = $conf->config_items; =head1 DESCRIPTION @@ -67,7 +72,7 @@ sub dir { $1; } -=item config +=item config KEY Returns the configuration value or values (depending on context) for key. @@ -90,7 +95,7 @@ sub config { } } -=item exists +=item exists KEY Returns true if the specified key exists, even if the corresponding value is undefined. @@ -103,7 +108,9 @@ sub exists { -e "$dir/$file"; } -=item touch +=item touch KEY + +Creates the specified configuration key if it does not exist. =cut @@ -116,7 +123,9 @@ sub touch { } } -=item set +=item set KEY VALUE + +Sets the specified configuration key to the given value. =cut @@ -139,7 +148,9 @@ sub set { # return ! eval { join('',@_), kill 0; 1; }; # } -=item delete +=item delete KEY + +Deletes the specified configuration key. =cut @@ -160,16 +171,27 @@ L. =cut sub config_items { -# my $self = shift; - @config_items; + my $self = shift; + #quelle kludge + @config_items, + map { + my $basename = basename($_); + $basename =~ /^(.*)$/; + $basename = $1; + new FS::ConfItem { + 'key' => $basename, + 'section' => 'billing', + 'description' => 'Alternate template file for invoices. See the billing documentation for details.', + 'type' => 'textarea', + } + } glob($self->dir. '/invoice_template_*') + ; } =back =head1 BUGS -Write access (touch, set, delete) should be documented. - If this was more than just crud that will never be useful outside Freeside I'd worry that config_items is freeside-specific and icky. @@ -291,8 +313,8 @@ httemplate/docs/config.html { 'key' => 'deletepayments', 'section' => 'UI', - 'description' => 'Enable deletion of unclosed payments. Be very careful! Only delete payments that were data-entry errors, not adjustments.', - 'type' => 'checkbox', + 'description' => 'Enable deletion of unclosed payments. Be very careful! Only delete payments that were data-entry errors, not adjustments. Optionally specify one or more comma-separated email addresses to be notified when a payment is deleted.', + 'type' => [qw( checkbox text )], }, { @@ -374,29 +396,29 @@ httemplate/docs/config.html { 'key' => 'icradiusmachines', - 'section' => 'radius', - 'description' => 'Turn this option on to enable radcheck and radreply table population - by default in the Freeside database, or in the database specified by the icradius_secrets config option (the radcheck and radreply tables needs to be created manually). You do not need to use MySQL for your Freeside database to export to an ICRADIUS/FreeRADIUS MySQL database with this option.
ADDITIONAL DEPRECATED FUNCTIONALITY (instead use MySQL replication or point icradius_secrets to the external database) - your ICRADIUS machines or FreeRADIUS (with MySQL authentication) machines, one per line. Machines listed in this file will have the radcheck table exported to them. Each line should contain four items, separted by whitespace: machine name, MySQL database name, MySQL username, and MySQL password. For example: "radius.isp.tld radius_db radius_user passw0rd"
', + 'section' => 'deprecated', + 'description' => 'DEPRECATED, add sqlradius exports to Service definitions instead. This option used to enable radcheck and radreply table population - by default in the Freeside database, or in the database specified by the icradius_secrets config option (the radcheck and radreply tables needs to be created manually). You do not need to use MySQL for your Freeside database to export to an ICRADIUS/FreeRADIUS MySQL database with this option.
ADDITIONAL DEPRECATED FUNCTIONALITY (instead use MySQL replication or point icradius_secrets to the external database) - your ICRADIUS machines or FreeRADIUS (with MySQL authentication) machines, one per line. Machines listed in this file will have the radcheck table exported to them. Each line should contain four items, separted by whitespace: machine name, MySQL database name, MySQL username, and MySQL password. For example: "radius.isp.tld radius_db radius_user passw0rd"
', 'type' => [qw( checkbox textarea )], }, { 'key' => 'icradius_mysqldest', - 'section' => 'radius', + 'section' => 'deprecated', 'description' => 'DEPRECATED (instead use MySQL replication or point icradius_secrets to the external database) - Destination directory for the MySQL databases, on the ICRADIUS/FreeRADIUS machines. Defaults to "/usr/local/var/".', 'type' => 'text', }, { 'key' => 'icradius_mysqlsource', - 'section' => 'radius', + 'section' => 'deprecated', 'description' => 'DEPRECATED (instead use MySQL replication or point icradius_secrets to the external database) - Source directory for for the MySQL radcheck table files, on the Freeside machine. Defaults to "/usr/local/var/freeside".', 'type' => 'text', }, { 'key' => 'icradius_secrets', - 'section' => 'radius', - 'description' => 'Optionally specifies a database for ICRADIUS/FreeRADIUS export. Three lines: DBI data source, username and password.', + 'section' => 'deprecated', + 'description' => 'DEPRECATED, add sqlradius exports to Service definitions instead. This option used to specify a database for ICRADIUS/FreeRADIUS export. Three lines: DBI data source, username and password.', 'type' => 'textarea', }, @@ -437,28 +459,40 @@ httemplate/docs/config.html { 'key' => 'mxmachines', - 'section' => 'BIND', + 'section' => 'deprecated', 'description' => 'MX entries for new domains, weight and machine, one per line, with trailing `.\'', 'type' => 'textarea', }, { 'key' => 'nsmachines', - 'section' => 'BIND', + 'section' => 'deprecated', 'description' => 'NS nameservers for new domains, one per line, with trailing `.\'', 'type' => 'textarea', }, { - 'key' => 'arecords', + 'key' => 'defaultrecords', 'section' => 'BIND', - 'description' => 'A list of tab seperated A records to add automatically when creating a domain', + 'description' => 'DNS entries add automatically when creating a domain', + 'type' => 'editlist', + 'editlist_parts' => [ { type=>'text' }, + { type=>'immutable', value=>'IN' }, + { type=>'select', + select_enum=>{ map { $_=>$_ } qw(A CNAME MX NS)} }, + { type=> 'text' }, ], + }, + + { + 'key' => 'arecords', + 'section' => 'deprecated', + 'description' => 'A list of tab seperated CNAME records to add automatically when creating a domain', 'type' => 'textarea', }, { 'key' => 'cnamerecords', - 'section' => 'BIND', + 'section' => 'deprecated', 'description' => 'A list of tab seperated CNAME records to add automatically when creating a domain', 'type' => 'textarea', },