| 1 | package oEdtk::Config; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | 40 | ▶ | use FindBin qw($Bin); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 3 | 40 | ▶ | use lib "$Bin"; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 40 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | 40 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||
| 7 | 40 | ▶ | use Config::IniFiles; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | 40 | ▶ | use Sys::Hostname; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 40 | ▶ | use oEdtk::logger qw(logger $LOGGERLEVEL $WARN2LOGGER); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||
| 11 | 40 | ▶ | use Exporter; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 12 | 40 | our $VERSION = 2.1129; | |||||||||||||||||||||||||||||||||||||||||
| 13 | 40 | our @ISA = qw(Exporter); | |||||||||||||||||||||||||||||||||||||||||
| 14 | 40 | our @EXPORT_OK = qw(config_read get_ini_path); | |||||||||||||||||||||||||||||||||||||||||
| 15 | 40 | my $_INI_PATH; | |||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||
| 17 | # Parsed-ini cache. config_read() re-parsed the ini on every call -- the P00 | ||||||||||||||||||||||||||||||||||||||||||
| 18 | # micro-profile saw the file parsed 15 times for 9 calls, and the many | ||||||||||||||||||||||||||||||||||||||||||
| 19 | # config_read('EDTK_DB') sites re-parse it again each time. Only the parse is | ||||||||||||||||||||||||||||||||||||||||||
| 20 | # shared: the section merge and the "$name" expansion stay per caller, and each | ||||||||||||||||||||||||||||||||||||||||||
| 21 | # call still builds a fresh hash, so a caller that edits the result cannot | ||||||||||||||||||||||||||||||||||||||||||
| 22 | # corrupt the cache. Keyed by the file's (mtime, size), so an edited ini is | ||||||||||||||||||||||||||||||||||||||||||
| 23 | # re-read; OEDTK_CONFIG_NOCACHE=1 (or a trailing { cache => 0 }) bypasses it. | ||||||||||||||||||||||||||||||||||||||||||
| 24 | my %_INI_SECTIONS; | ||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||
| 26 | # The sections of an ini file as a plain snapshot, section => { key => value }, | ||||||||||||||||||||||||||||||||||||||||||
| 27 | # holding each section's OWN keys: the %{ $allcfg{$_} } spread the merge does | ||||||||||||||||||||||||||||||||||||||||||
| 28 | # never sees the DEFAULT fallback. Cached by (path, mtime, size) unless | ||||||||||||||||||||||||||||||||||||||||||
| 29 | # $use_cache is false. | ||||||||||||||||||||||||||||||||||||||||||
| 30 | 66 | ▶ | sub _ini_sections { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_ini_sections: called CC=8 SCAR=22.0
| |||||||||||||||||||||||||||||||||||||||||||
| 31 | 66 | my ( $path, $use_cache ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 32 | 66 | my @stat = stat $path; | |||||||||||||||||||||||||||||||||||||||||
| 33 | 66 | ▶ | if ( $use_cache && @stat ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$use_cache and @stat
MC/DC0%0/2
$use_cache and @stat
$use_cache
@stat
Truth table33%1/3
A and B
A= $use_cacheB= @stat
| |||||||||||||||||||||||||||||||||||||||||||
| 34 | 66 | my $hit = $_INI_SECTIONS{$path}; | |||||||||||||||||||||||||||||||||||||||||
| 35 | return $hit->{'sections'} | ||||||||||||||||||||||||||||||||||||||||||
| 36 | 66 | ▶ | if $hit && $hit->{'mtime'} == $stat[9] && $hit->{'size'} == $stat[7]; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
$hit and $hit->{"mtime"} == $stat[9] and $hit->{"size"} == $stat[7]
$hit and $hit->{"mtime"} == $stat[9]
MC/DC33%1/3
$hit and $hit->{"mtime"} == $stat[9] and $hit->{"size"} == $stat[7]
$hit
$hit->{"mtime"} == $stat[9]
$hit->{"size"} == $stat[7]
Truth table50%2/4
A and B and C
A= $hitB= $hit->{"mtime"} == $stat[9]C= $hit->{"size"} == $stat[7]
| |||||||||||||||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||
| 39 | # -fallback => 'DEFAULT' (the fork's option) lets a section fall back to | ||||||||||||||||||||||||||||||||||||||||||
| 40 | # DEFAULT for a key it does not define. The tie is kept verbatim so | ||||||||||||||||||||||||||||||||||||||||||
| 41 | # Config::IniFiles still owns the parsing; the cache only avoids redoing it. | ||||||||||||||||||||||||||||||||||||||||||
| 42 | 25 | ▶ | tie my %allcfg, 'Config::IniFiles', | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 43 | ( -file => $path, -default => 'DEFAULT', -fallback => 'DEFAULT' ) | ||||||||||||||||||||||||||||||||||||||||||
| 44 | or die &logger( -1, "Config file not found or unreadable : $path" ); | ||||||||||||||||||||||||||||||||||||||||||
| 45 | 25 | my %sections = map { $_ => { %{ $allcfg{$_} } } } keys %allcfg; | |||||||||||||||||||||||||||||||||||||||||
| 46 | 25 | ▶ | $_INI_SECTIONS{$path} = { mtime => $stat[9], size => $stat[7], sections => \%sections } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 47 | if @stat; | ||||||||||||||||||||||||||||||||||||||||||
| 48 | 25 | return \%sections; | |||||||||||||||||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||
| 51 | # Config::IniFiles' val() under -fallback => 'DEFAULT': the section's own value, | ||||||||||||||||||||||||||||||||||||||||||
| 52 | # else DEFAULT's, else undef. Backs the hostname redirect below. | ||||||||||||||||||||||||||||||||||||||||||
| 53 | 66 | ▶ | sub _section_val { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_section_val: called CC=5 SCAR=19.6
| |||||||||||||||||||||||||||||||||||||||||||
| 54 | 66 | my ( $sections, $section, $key ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 55 | 66 | my $own = $sections->{$section}; | |||||||||||||||||||||||||||||||||||||||||
| 56 | 66 | ▶ | return $own->{$key} if $own && defined $own->{$key}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$own and defined $own->{$key}
MC/DC0%0/2
$own and defined $own->{$key}
$own
defined $own->{$key}
Truth table33%1/3
A and B
A= $ownB= defined $own->{$key}
| |||||||||||||||||||||||||||||||||||||||||||
| 57 | 66 | my $def = $sections->{'DEFAULT'}; | |||||||||||||||||||||||||||||||||||||||||
| 58 | 66 | ▶ | return $def->{$key} if $def && defined $def->{$key}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$def and defined $def->{$key}
MC/DC0%0/2
$def and defined $def->{$key}
$def
defined $def->{$key}
Truth table33%1/3
A and B
A= $defB= defined $def->{$key}
| |||||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||
| 62 | 0 | ▶ | sub get_ini_path() { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_ini_path: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 63 | 0 | return $_INI_PATH; | |||||||||||||||||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||
| 66 | 66 | ▶ | sub config_read { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
config_read: called CC=21 SCAR=35.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 67 | 66 | my ( $sections, $app ); | |||||||||||||||||||||||||||||||||||||||||
| 68 | 66 | my @args = @_; | |||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||
| 70 | # Optional trailing { cache => 0 } forces a fresh parse. No caller passes a | ||||||||||||||||||||||||||||||||||||||||||
| 71 | # hashref today (sections are strings or one array ref), so it is unambiguous. | ||||||||||||||||||||||||||||||||||||||||||
| 72 | 66 | ▶ | my $use_cache = $ENV{OEDTK_CONFIG_NOCACHE} ? 0 : 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 73 | 66 | ▶ | if ( @args && ref $args[-1] eq 'HASH' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@args and ref $args[-1] eq "HASH"
MC/DC0%0/2
@args and ref $args[-1] eq "HASH"
@args
ref $args[-1] eq "HASH"
Truth table66%2/3
A and B
A= @argsB= ref $args[-1] eq "HASH"
| |||||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | my $opt = pop @args; | |||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | ▶ | $use_cache = 0 if exists $opt->{'cache'} && !$opt->{'cache'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $opt->{"cache"} and not $opt->{"cache"}
MC/DC0%0/2
exists $opt->{"cache"} and not $opt->{"cache"}
exists $opt->{"cache"}
not $opt->{"cache"}
Truth table0%0/3
A and not(B)
A= exists $opt->{"cache"}B= not $opt->{"cache"}
| |||||||||||||||||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||
| 78 | 66 | ▶ | if ( ref( $args[0] ) eq 'ARRAY' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | $sections = $args[0]; | |||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | $app = $args[1]; | |||||||||||||||||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||||||||||||||||
| 82 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 83 | 66 | $sections = \@args; | |||||||||||||||||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||
| 86 | 66 | my $mod = __PACKAGE__; | |||||||||||||||||||||||||||||||||||||||||
| 87 | 66 | $mod =~ s/::/\//; | |||||||||||||||||||||||||||||||||||||||||
| 88 | 66 | $mod .= '.pm'; | |||||||||||||||||||||||||||||||||||||||||
| 89 | 66 | my $dir = $INC{$mod}; | |||||||||||||||||||||||||||||||||||||||||
| 90 | 66 | $dir =~ s/\/[^\/]+$//; | |||||||||||||||||||||||||||||||||||||||||
| 91 | 66 | &logger( 7, "lib \$Bin = $Bin" ); | |||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||
| 93 | 66 | my $ini; | |||||||||||||||||||||||||||||||||||||||||
| 94 | 66 | ▶ | if ( -e "$Bin/edtk.ini" ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 95 | 38 | $ini = "$Bin/edtk.ini"; | |||||||||||||||||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||||||||||||||||
| 97 | elsif ( -e "$dir/iniEdtk/edtk.ini" ) { | ||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | $ini = "$dir/iniEdtk/edtk.ini"; | |||||||||||||||||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||||||||||||||||
| 100 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 101 | 28 | $ini = "$dir/iniEdtk/tplate.edtk.ini"; | |||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||
| 103 | #warn "INFO: accessing $ini\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 104 | 28 | &logger( 6, "Accessing $ini" ); | |||||||||||||||||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||||||||||||||||
| 106 | 66 | my $uchost = hostname(); | |||||||||||||||||||||||||||||||||||||||||
| 107 | 66 | $uchost = uc($uchost); | |||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||
| 109 | 66 | my $file_sections; | |||||||||||||||||||||||||||||||||||||||||
| 110 | 66 | for ( ; ; ) { | |||||||||||||||||||||||||||||||||||||||||
| 111 | 66 | ▶ | die &logger( -1, "Config file not found or unreadable : $ini" ) unless -r $ini; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||
| 113 | #die "ERROR: config file not found or unreadable: $ini\n" unless -r $ini; | ||||||||||||||||||||||||||||||||||||||||||
| 114 | 66 | $file_sections = _ini_sections( $ini, $use_cache ); | |||||||||||||||||||||||||||||||||||||||||
| 115 | 66 | $_INI_PATH = $ini; | |||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||
| 117 | 66 | my $ini2 = _section_val( $file_sections, $uchost, 'iniEdtk' ); | |||||||||||||||||||||||||||||||||||||||||
| 118 | 66 | ▶ | last if not defined $ini2 or $ini2 eq $ini or $ini2 eq 'local'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
not defined $ini2 or $ini2 eq $ini or $ini2 eq "local"
not defined $ini2 or $ini2 eq $ini
MC/DC0%0/3
not defined $ini2 or $ini2 eq $ini or $ini2 eq "local"
not defined $ini2
$ini2 eq $ini
$ini2 eq "local"
Truth table25%1/4
not(A) or B or C
A= not defined $ini2B= $ini2 eq $iniC= $ini2 eq "local"
| |||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | $ini = $ini2; | |||||||||||||||||||||||||||||||||||||||||
| 120 | } | ||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||
| 122 | # Get the DEFAULT and ENVDESC sections by default, override with the optional | ||||||||||||||||||||||||||||||||||||||||||
| 123 | # sections that we were given, and finally with the hostname section. | ||||||||||||||||||||||||||||||||||||||||||
| 124 | 66 | my %cfg = (); | |||||||||||||||||||||||||||||||||||||||||
| 125 | 66 | $cfg{'EDTK_HOST'} = $uchost; | |||||||||||||||||||||||||||||||||||||||||
| 126 | 66 | ▶ | $cfg{'USERNAME'} = getlogin || getpwuid($<) || "undef"; | ||||||||||||||||||||||||||||||||||||||||
|
Condition40%2/5
getlogin || getpwuid $< || 'undef'
getlogin or getpwuid $<
MC/DC0%0/2
getlogin || getpwuid $< || 'undef'
getlogin
getpwuid $<
Truth table33%1/3
A or B
A= getloginB= getpwuid $<
| |||||||||||||||||||||||||||||||||||||||||||
| 127 | 66 | foreach ( 'DEFAULT', 'ENVDESC', @$sections, $uchost ) { | |||||||||||||||||||||||||||||||||||||||||
| 128 | 220 | ▶ | if ( exists $file_sections->{$_} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 129 | 154 | %cfg = ( %cfg, %{ $file_sections->{$_} } ); | |||||||||||||||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||
| 133 | # Get current application name | ||||||||||||||||||||||||||||||||||||||||||
| 134 | 66 | ▶ | if ( defined($app) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | $cfg{'EDTK_PRGNAME'} = $app; | |||||||||||||||||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||||||||||||||||
| 137 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 138 | 66 | ▶ | if ( $0 =~ /([\w\-\.]+)\.p[lm]$/i ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | $cfg{'EDTK_PRGNAME'} = $1; | |||||||||||||||||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||||||||||||||||
| 141 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 142 | 66 | $cfg{'EDTK_PRGNAME'} = $0; | |||||||||||||||||||||||||||||||||||||||||
| 143 | } | ||||||||||||||||||||||||||||||||||||||||||
| 144 | } | ||||||||||||||||||||||||||||||||||||||||||
| 145 | 66 | $cfg{'EDTK_PRGPATH'} = $Bin; | |||||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||||||
| 147 | # Expand variables inside other variables, resolving each "$name" through | ||||||||||||||||||||||||||||||||||||||||||
| 148 | # read_hash (the fork's accessor): an absent or undef key yields an empty | ||||||||||||||||||||||||||||||||||||||||||
| 149 | # string rather than an uninitialised-value warning. | ||||||||||||||||||||||||||||||||||||||||||
| 150 | 66 | foreach my $key ( keys %cfg ) { | |||||||||||||||||||||||||||||||||||||||||
| 151 | 3650 | ▶ | 1 while $cfg{$key} =~ s/\$(\w+)/read_hash(\%cfg, $1)/gsex; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 152 | } | ||||||||||||||||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||||||||||||||
| 154 | 66 | return \%cfg; | |||||||||||||||||||||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||
| 157 | # Return the value bound to a key of a configuration hash, or an empty string | ||||||||||||||||||||||||||||||||||||||||||
| 158 | # when the key is absent or carries an undef value (a warning is issued in both | ||||||||||||||||||||||||||||||||||||||||||
| 159 | # cases). Ported from the fork (PLAN S60); it backs the "$name" expansion above. | ||||||||||||||||||||||||||||||||||||||||||
| 160 | 2600 | ▶ | sub read_hash { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
read_hash: called CC=3 SCAR=14.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 161 | 2600 | my ( $href, $key ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 162 | 2600 | ▶ | if ( exists $href->{$key} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 163 | 2600 | ▶ | return $href->{$key} if defined $href->{$key}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 164 | 0 | warn "Key '$key' has an undef value in the configuration hash\n"; | |||||||||||||||||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||||||||||||||||
| 166 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | warn "Key '$key' does not exist in the configuration hash\n"; | |||||||||||||||||||||||||||||||||||||||||
| 168 | } | ||||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | return ''; | |||||||||||||||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||
| 172 | 40 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||
| 174 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||
| 176 | oEdtk::Config - read the oEdtk configuration (edtk.ini) | ||||||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||||||
| 178 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||||||||||||
| 180 | use oEdtk::Config qw(config_read get_ini_path); | ||||||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||||||
| 182 | my $cfg = config_read('EDTK_DB'); | ||||||||||||||||||||||||||||||||||||||||||
| 183 | my $dsn = $cfg->{'EDTK_DBI_DSN'}; | ||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||
| 185 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||
| 187 | The configuration reader for the whole toolkit. It locates the F<edtk.ini> | ||||||||||||||||||||||||||||||||||||||||||
| 188 | file (with a hostname redirect loop), merges the C<DEFAULT>, C<ENVDESC>, the | ||||||||||||||||||||||||||||||||||||||||||
| 189 | requested and the hostname sections into one hash, adds C<EDTK_HOST>, | ||||||||||||||||||||||||||||||||||||||||||
| 190 | C<USERNAME>, C<EDTK_PRGNAME> and C<EDTK_PRGPATH>, and expands C<$name> | ||||||||||||||||||||||||||||||||||||||||||
| 191 | references found inside the values. Each call returns a fresh hash. | ||||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||
| 193 | The parsing is memoised by the file's C<(path, mtime, size)>; set | ||||||||||||||||||||||||||||||||||||||||||
| 194 | C<OEDTK_CONFIG_NOCACHE=1>, or pass a trailing options hashref with C<cache> set | ||||||||||||||||||||||||||||||||||||||||||
| 195 | to 0, to force a re-parse. | ||||||||||||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||||||||||||
| 197 | =head1 FUNCTIONS | ||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||
| 199 | =head2 config_read | ||||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||
| 201 | my $cfg = config_read(@sections); | ||||||||||||||||||||||||||||||||||||||||||
| 202 | my $cfg = config_read([@sections], $app); | ||||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||
| 204 | Read the configuration and return a hash reference of merged sections. | ||||||||||||||||||||||||||||||||||||||||||
| 205 | C<@sections> is the list of extra sections to merge (C<DEFAULT> and C<ENVDESC> | ||||||||||||||||||||||||||||||||||||||||||
| 206 | are always merged), optionally given as an array reference together with an | ||||||||||||||||||||||||||||||||||||||||||
| 207 | application name that sets C<EDTK_PRGNAME>. | ||||||||||||||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||||||||||||
| 209 | =head2 get_ini_path | ||||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||
| 211 | my $path = get_ini_path(); | ||||||||||||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||||||||||||
| 213 | Return the path of the ini file used by the last C<config_read> call. | ||||||||||||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||||||||||||
| 215 | The private helpers C<_ini_sections> and C<_section_val>, and the C<read_hash> | ||||||||||||||||||||||||||||||||||||||||||
| 216 | accessor, back the caching, the C<DEFAULT> fallback and the C<$name> expansion; | ||||||||||||||||||||||||||||||||||||||||||
| 217 | they are not part of the public API. | ||||||||||||||||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||||||||||||||||
| 219 | =head1 CONFIGURATION | ||||||||||||||||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||||||||||||||
| 221 | The lexicon of the keys the shipped template F<tplate.edtk.ini> sets, by section, with what | ||||||||||||||||||||||||||||||||||||||||||
| 222 | each drives and the values that change behaviour. A C<$name> value (for example | ||||||||||||||||||||||||||||||||||||||||||
| 223 | C<$EDTK_DIR_BASE>) is expanded by C<config_read>; a key with no listed values is free-form. | ||||||||||||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||||||||||||
| 225 | =head2 The C<[DEFAULT]> section | ||||||||||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||||||||||
| 227 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||
| 229 | =item C<iniEdtk> | ||||||||||||||||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||||||||||||||||
| 231 | Redirect the read to another ini file; also read from the host-name section. The literal | ||||||||||||||||||||||||||||||||||||||||||
| 232 | C<local> disables the redirect. | ||||||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||||||
| 234 | =item C<EDTK_CORP> | ||||||||||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||||||||||
| 236 | Corporation name printed in the generated documents. | ||||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||
| 238 | =item C<EDTK_DICO> | ||||||||||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||||||||||
| 240 | Main dictionary (accents, entities) loaded by the text layer. | ||||||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||||||
| 242 | =item C<EDTK_DICO_POST> | ||||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||
| 244 | Postal-code dictionary. | ||||||||||||||||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||||||||||||||||
| 246 | =item C<EDTK_SNIP_ADDR> | ||||||||||||||||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||||||||||||||||
| 248 | Address-snipping dictionary. | ||||||||||||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||||||||||||
| 250 | =item C<EDTK_SNIP_RATE> | ||||||||||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||||||||
| 252 | Address-snipping rate; C<0> disables snipping. | ||||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||
| 254 | =item C<EDTK_LANG> | ||||||||||||||||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||||||||||||||||
| 256 | Language, i.e. the dictionary section to read, such as C<EN> or C<FR>. | ||||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||
| 258 | =item C<EDTK_LOG_LVL> | ||||||||||||||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||||||||||||||
| 260 | Log sensitivity read by L<oEdtk::logger> (its C<$LOGGERLEVEL>); C<4> is the mainline default. | ||||||||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||||||
| 262 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||||||||||||||||
| 264 | =head2 The C<[ENVDESC]> section | ||||||||||||||||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||||||||||||||||
| 266 | Directories, file stems, extensions and timeouts. Every path is written relative to | ||||||||||||||||||||||||||||||||||||||||||
| 267 | C<EDTK_DIR_BASE> (default C<$EDTK_PRGPATH>, the running script's directory) and to | ||||||||||||||||||||||||||||||||||||||||||
| 268 | C<EDTK_PRGNAME> (injected at runtime). | ||||||||||||||||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||||||||||||||||
| 270 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||||||||||||||||
| 272 | =item C<EDTK_DIR_BASE> | ||||||||||||||||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||||||||||||||||
| 274 | Root of the whole path tree; defaults to C<$EDTK_PRGPATH>. | ||||||||||||||||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||||||||||||||||
| 276 | =item C<EDTK_DIR_APP>, C<EDTK_DIR_SCRIPT> | ||||||||||||||||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||||||||||||||||
| 278 | Application root and the per-application script directory. | ||||||||||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||||||||||
| 280 | =item C<EDTK_DIR_CONFIG> | ||||||||||||||||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||||||||||||||||
| 282 | Configuration files and dictionaries. | ||||||||||||||||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||||||||||||||
| 284 | =item C<EDTK_DIR_APPTMP>, C<EDTK_DIR_DB> | ||||||||||||||||||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||||||||||||||||
| 286 | Temporary work area and database files. | ||||||||||||||||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||||||||||||||||
| 288 | =item C<EDTK_DIR_DATA_IN> | ||||||||||||||||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||||||||||||||||
| 290 | Input flux directory. | ||||||||||||||||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||||||||||||||||
| 292 | =item C<EDTK_DIR_LIB>, C<EDTK_DIR_TMPLATE> | ||||||||||||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||||||||||||
| 294 | Shared libraries and document templates. | ||||||||||||||||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||||||||||||||||
| 296 | =item C<EDTK_DIR_OUTMNGR>, C<EDTK_DIR_EDOCMNGR>, C<EDTK_DIR_DOCLIB> | ||||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||
| 298 | Output, EDMS transit and document library. | ||||||||||||||||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||||||||||||||||
| 300 | =item C<EDTK_DIR_LOG>, C<EDTK_DIR_DOCSCRIPT> | ||||||||||||||||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||||||||||||||||
| 302 | Logs and the per-application document area. | ||||||||||||||||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||||||||||||||||
| 304 | =item C<EDTK_DOCLIB_LOCK> | ||||||||||||||||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||||||||||||||||
| 306 | Document-library lock file. | ||||||||||||||||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||||||||||||||||
| 308 | =item C<EDTK_FDATAIN>, C<EDTK_FDATAOUT>, C<EDTK_FDATWORK> | ||||||||||||||||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||||||||||||||||
| 310 | Input, output and work file stems. | ||||||||||||||||||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||||||||||||||||
| 312 | =item C<EDTK_TYPE_ENV> | ||||||||||||||||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||||||||||||||||
| 314 | Environment label, prefixed to mail subjects by L<oEdtk::Messenger>; C<Dev> (the default), | ||||||||||||||||||||||||||||||||||||||||||
| 315 | C<Test> or C<Production>. | ||||||||||||||||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||||||||||||||||
| 317 | =item C<EDTK_OUTMNGR_MERGE> | ||||||||||||||||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||||||||||||||||
| 319 | Whether the outgoing-routeur output is merged; C<no> (the default) or C<yes>. | ||||||||||||||||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||||||||||||||||
| 321 | =item C<EDTK_PRGNAME> | ||||||||||||||||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||||||||||||||||
| 323 | Running program name; injected by C<config_read>, not normally set. | ||||||||||||||||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||||||||||||||||
| 325 | =item C<EDTK_VCS_LOCATION> | ||||||||||||||||||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||||||||||||||||
| 327 | Version-control location recorded in outputs. | ||||||||||||||||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||||||||||||||||
| 329 | =item C<EDTK_WATERMARKTEXT> | ||||||||||||||||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||||||||||||||||
| 331 | Watermark stamped on generated documents. | ||||||||||||||||||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||||||||||||||||
| 333 | =item C<EDTK_BIN_PERL> | ||||||||||||||||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||||||||||||||||
| 335 | Path to the Perl interpreter used when bundling. | ||||||||||||||||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||||||||||||||||
| 337 | =item C<EDTK_EXT_COMP_OMGR> | ||||||||||||||||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||||||||||||||||
| 339 | Extension of the routeur-composed files; C<omgr>. | ||||||||||||||||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||||||||||||||||
| 341 | =item C<EDTK_EXT_COMPO> | ||||||||||||||||||||||||||||||||||||||||||
| 342 | |||||||||||||||||||||||||||||||||||||||||||
| 343 | Extension of a composed file; defaults to C<$EDTK_EXT_LATEX>. | ||||||||||||||||||||||||||||||||||||||||||
| 344 | |||||||||||||||||||||||||||||||||||||||||||
| 345 | =item C<EDTK_EXT_DATA>, C<EDTK_EXT_DEFAULT> | ||||||||||||||||||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||||||||||||||||
| 347 | Data-file extension (C<DAT>) and default extension (C<$EDTK_EXT_PDF>). | ||||||||||||||||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||||||||||||||||
| 349 | =item C<EDTK_EXT_EXCEL>, C<EDTK_EXT_LATEX>, C<EDTK_EXT_PCL>, C<EDTK_EXT_PDF>, C<EDTK_EXT_PERL>, C<EDTK_EXT_WORK> | ||||||||||||||||||||||||||||||||||||||||||
| 350 | |||||||||||||||||||||||||||||||||||||||||||
| 351 | Extension per artefact type: C<xls>, C<tex>, C<pcl>, C<pdf>, C<pl>, C<txt>. | ||||||||||||||||||||||||||||||||||||||||||
| 352 | |||||||||||||||||||||||||||||||||||||||||||
| 353 | =item C<EDTK_WAITRUN> | ||||||||||||||||||||||||||||||||||||||||||
| 354 | |||||||||||||||||||||||||||||||||||||||||||
| 355 | Seconds to wait for a child process; default C<8>. | ||||||||||||||||||||||||||||||||||||||||||
| 356 | |||||||||||||||||||||||||||||||||||||||||||
| 357 | =item C<EDTK_XLS_MAX_ROW> | ||||||||||||||||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||||||||||||||||
| 359 | Maximum rows read from an XLS sheet; default C<30000>. | ||||||||||||||||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||||||||||||||||
| 361 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||||||||||||||||
| 363 | =head2 The C<[EDTK_DB]> section | ||||||||||||||||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||||||||||||||||
| 365 | Database DSNs, credentials, retention, primary-key mode and bulk-load tuning. | ||||||||||||||||||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||||||||||||||||
| 367 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 368 | |||||||||||||||||||||||||||||||||||||||||||
| 369 | =item C<EDTK_DBI_DSN> (with C<_USER>, C<_PASS>) | ||||||||||||||||||||||||||||||||||||||||||
| 370 | |||||||||||||||||||||||||||||||||||||||||||
| 371 | Active DSN and credentials of the main database. | ||||||||||||||||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||||||||||||||||
| 373 | =item C<EDTK_DBI_DSN_BAK> (with C<_USER>, C<_PASS>) | ||||||||||||||||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||||||||||||||||
| 375 | DSN and credentials of the backup database. | ||||||||||||||||||||||||||||||||||||||||||
| 376 | |||||||||||||||||||||||||||||||||||||||||||
| 377 | =item C<EDTK_DBI_PARAM> | ||||||||||||||||||||||||||||||||||||||||||
| 378 | |||||||||||||||||||||||||||||||||||||||||||
| 379 | DSN of the parameter database. | ||||||||||||||||||||||||||||||||||||||||||
| 380 | |||||||||||||||||||||||||||||||||||||||||||
| 381 | =item C<EDTK_DBI_ACQUIT>, C<EDTK_DBI_DISTRIB>, C<EDTK_DBI_DISTRIB_STATS>, C<EDTK_DBI_OUTMNGR>, C<EDTK_DBI_OUTMNGR_STATS>, C<EDTK_DBI_TRACKING> | ||||||||||||||||||||||||||||||||||||||||||
| 382 | |||||||||||||||||||||||||||||||||||||||||||
| 383 | Logical table names of the acquittal, distribution, distribution-stats, outgoing, | ||||||||||||||||||||||||||||||||||||||||||
| 384 | outgoing-stats and tracking tables. | ||||||||||||||||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||||||||||||||||
| 386 | =item C<EDTK_MAX_USER_KEY> | ||||||||||||||||||||||||||||||||||||||||||
| 387 | |||||||||||||||||||||||||||||||||||||||||||
| 388 | Number of user tracking keys accepted; C<10> in the mainline, C<5> in the fork. | ||||||||||||||||||||||||||||||||||||||||||
| 389 | |||||||||||||||||||||||||||||||||||||||||||
| 390 | =item C<EDTK_TRACKING_KEYS> | ||||||||||||||||||||||||||||||||||||||||||
| 391 | |||||||||||||||||||||||||||||||||||||||||||
| 392 | Comma-separated extra tracking columns. | ||||||||||||||||||||||||||||||||||||||||||
| 393 | |||||||||||||||||||||||||||||||||||||||||||
| 394 | =item C<EDTK_TRACK_MODE> | ||||||||||||||||||||||||||||||||||||||||||
| 395 | |||||||||||||||||||||||||||||||||||||||||||
| 396 | Tracking back-end: C<SQLite> (the default) or C<none> to switch tracking off. | ||||||||||||||||||||||||||||||||||||||||||
| 397 | |||||||||||||||||||||||||||||||||||||||||||
| 398 | =item C<EDTK_TRACK_SIG> | ||||||||||||||||||||||||||||||||||||||||||
| 399 | |||||||||||||||||||||||||||||||||||||||||||
| 400 | Which signals the tracker catches: C<warn> (all) or C<halt> (die only); C<no> disables. | ||||||||||||||||||||||||||||||||||||||||||
| 401 | |||||||||||||||||||||||||||||||||||||||||||
| 402 | =item C<EDTK_DB_MAX_DAYS_KEPT>, C<EDTK_DB_MAX_DAYS_KEPT_STATS>, C<EDTK_DB_MAX_DAYS_TRACKED>, C<EDTK_DB_MAX_DAYS_AGREGED> | ||||||||||||||||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||||||||||||||||
| 404 | Retention in days of the main, stats, tracking and aggregated tables; C<2>, C<100>, C<400> | ||||||||||||||||||||||||||||||||||||||||||
| 405 | and C<600>. | ||||||||||||||||||||||||||||||||||||||||||
| 406 | |||||||||||||||||||||||||||||||||||||||||||
| 407 | =item C<EDTK_DB_CHECK_AUTO> | ||||||||||||||||||||||||||||||||||||||||||
| 408 | |||||||||||||||||||||||||||||||||||||||||||
| 409 | Enables the automatic consistency check; C<NO> (the default) or C<YES>. | ||||||||||||||||||||||||||||||||||||||||||
| 410 | |||||||||||||||||||||||||||||||||||||||||||
| 411 | =item C<EDTK_DB_CHECK_MONTH_DAY> | ||||||||||||||||||||||||||||||||||||||||||
| 412 | |||||||||||||||||||||||||||||||||||||||||||
| 413 | Day of month for the automatic check; default C<15>. | ||||||||||||||||||||||||||||||||||||||||||
| 414 | |||||||||||||||||||||||||||||||||||||||||||
| 415 | =item C<EDTK_DB_PK_IDJOB> | ||||||||||||||||||||||||||||||||||||||||||
| 416 | |||||||||||||||||||||||||||||||||||||||||||
| 417 | Keep C<ed_idjob> in the INDEX primary key: C<yes> (mainline behaviour), any other value | ||||||||||||||||||||||||||||||||||||||||||
| 418 | builds the schema without it (fork). | ||||||||||||||||||||||||||||||||||||||||||
| 419 | |||||||||||||||||||||||||||||||||||||||||||
| 420 | =item C<EDTK_DB_IDJOB_DEFAULT> | ||||||||||||||||||||||||||||||||||||||||||
| 421 | |||||||||||||||||||||||||||||||||||||||||||
| 422 | Value written to C<ed_idjob> when the key is kept; left empty until the S51 gate. | ||||||||||||||||||||||||||||||||||||||||||
| 423 | |||||||||||||||||||||||||||||||||||||||||||
| 424 | =item C<EDTK_DB_FetchHashKeyName> | ||||||||||||||||||||||||||||||||||||||||||
| 425 | |||||||||||||||||||||||||||||||||||||||||||
| 426 | Case-folding of the fetched column names (C<FetchHashKeyName>); C<NAME_uc> by default. | ||||||||||||||||||||||||||||||||||||||||||
| 427 | |||||||||||||||||||||||||||||||||||||||||||
| 428 | =item C<EDTK_DB_COPY_ENCODING> | ||||||||||||||||||||||||||||||||||||||||||
| 429 | |||||||||||||||||||||||||||||||||||||||||||
| 430 | Source encoding of the CSV bulk-load path: C<UTF8> declares a file already in UTF-8 so it is | ||||||||||||||||||||||||||||||||||||||||||
| 431 | not double-encoded, empty keeps the legacy Latin-1 behaviour. | ||||||||||||||||||||||||||||||||||||||||||
| 432 | |||||||||||||||||||||||||||||||||||||||||||
| 433 | =item C<EDTK_DB_DEFER_INDEX_RATIO>, C<EDTK_DB_DEFER_INDEX_MIN_ROWS> | ||||||||||||||||||||||||||||||||||||||||||
| 434 | |||||||||||||||||||||||||||||||||||||||||||
| 435 | Opt-in index-deferral policy of the PostgreSQL bulk load; empty means off, and when set the | ||||||||||||||||||||||||||||||||||||||||||
| 436 | defaults are C<0.1> and C<10000>. | ||||||||||||||||||||||||||||||||||||||||||
| 437 | |||||||||||||||||||||||||||||||||||||||||||
| 438 | =item C<EDTK_DB_BURST_MO> | ||||||||||||||||||||||||||||||||||||||||||
| 439 | |||||||||||||||||||||||||||||||||||||||||||
| 440 | ELT staging threshold in MiB on PostgreSQL: C<50> by default, C<0> disables the path, and an | ||||||||||||||||||||||||||||||||||||||||||
| 441 | empty or invalid value falls back to 50. | ||||||||||||||||||||||||||||||||||||||||||
| 442 | |||||||||||||||||||||||||||||||||||||||||||
| 443 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 444 | |||||||||||||||||||||||||||||||||||||||||||
| 445 | =head2 The C<[EDTK_STATS]> section | ||||||||||||||||||||||||||||||||||||||||||
| 446 | |||||||||||||||||||||||||||||||||||||||||||
| 447 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 448 | |||||||||||||||||||||||||||||||||||||||||||
| 449 | =item C<EDTK_DBI_STATS>, C<EDTK_DSN_STATS> (with C<_USER>, C<_PASS>) | ||||||||||||||||||||||||||||||||||||||||||
| 450 | |||||||||||||||||||||||||||||||||||||||||||
| 451 | DSN and credentials of the statistics database; they default to the main DSN. | ||||||||||||||||||||||||||||||||||||||||||
| 452 | |||||||||||||||||||||||||||||||||||||||||||
| 453 | =item C<EDTK_STATS_TRACKING>, C<EDTK_STATS_OUTMNGR>, C<EDTK_STATS_DISTRIB>, C<EDTK_STATS_ACQUIT> | ||||||||||||||||||||||||||||||||||||||||||
| 454 | |||||||||||||||||||||||||||||||||||||||||||
| 455 | Statistics table names. | ||||||||||||||||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||||||||||||||||
| 457 | =item C<EDTK_STATS_MANUFACT> | ||||||||||||||||||||||||||||||||||||||||||
| 458 | |||||||||||||||||||||||||||||||||||||||||||
| 459 | Manufacturer filter of the outgoing statistics: a comma- or space-separated list of | ||||||||||||||||||||||||||||||||||||||||||
| 460 | C<ED_IDMANUFACT> codes, empty (the default) reports them all. | ||||||||||||||||||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||||||||||||||||
| 462 | =item C<EDTK_CSV_HEADER_METADATA>, C<EDTK_CSV_HEADER_DISTRIB> | ||||||||||||||||||||||||||||||||||||||||||
| 463 | |||||||||||||||||||||||||||||||||||||||||||
| 464 | Column order of the CSV exports. | ||||||||||||||||||||||||||||||||||||||||||
| 465 | |||||||||||||||||||||||||||||||||||||||||||
| 466 | =item C<EDTK_STATS_SQL00> through C<EDTK_STATS_SQL12>, C<EDTK_STATS_SQL90> | ||||||||||||||||||||||||||||||||||||||||||
| 467 | |||||||||||||||||||||||||||||||||||||||||||
| 468 | Named canned SQL queries of the statistics panel; C<EDTK_STATS_SQL90> may name a F<.sql> | ||||||||||||||||||||||||||||||||||||||||||
| 469 | file (C<$EDTK_PRGPATH/sql/...>). | ||||||||||||||||||||||||||||||||||||||||||
| 470 | |||||||||||||||||||||||||||||||||||||||||||
| 471 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 472 | |||||||||||||||||||||||||||||||||||||||||||
| 473 | =head2 The C<[MAIL]> section | ||||||||||||||||||||||||||||||||||||||||||
| 474 | |||||||||||||||||||||||||||||||||||||||||||
| 475 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 476 | |||||||||||||||||||||||||||||||||||||||||||
| 477 | =item C<EDTK_MAIL_TO>, C<EDTK_MAIL_TST> | ||||||||||||||||||||||||||||||||||||||||||
| 478 | |||||||||||||||||||||||||||||||||||||||||||
| 479 | Production and test recipients. | ||||||||||||||||||||||||||||||||||||||||||
| 480 | |||||||||||||||||||||||||||||||||||||||||||
| 481 | =item C<EDTK_MAIL_SENDER> | ||||||||||||||||||||||||||||||||||||||||||
| 482 | |||||||||||||||||||||||||||||||||||||||||||
| 483 | Envelope sender. | ||||||||||||||||||||||||||||||||||||||||||
| 484 | |||||||||||||||||||||||||||||||||||||||||||
| 485 | =item C<EDTK_MAIL_SUBJ> | ||||||||||||||||||||||||||||||||||||||||||
| 486 | |||||||||||||||||||||||||||||||||||||||||||
| 487 | Subject template; C<%date> and C<%time> are substituted. | ||||||||||||||||||||||||||||||||||||||||||
| 488 | |||||||||||||||||||||||||||||||||||||||||||
| 489 | =item C<EDTK_MAIL_SMTP> | ||||||||||||||||||||||||||||||||||||||||||
| 490 | |||||||||||||||||||||||||||||||||||||||||||
| 491 | SMTP relay host. | ||||||||||||||||||||||||||||||||||||||||||
| 492 | |||||||||||||||||||||||||||||||||||||||||||
| 493 | =item C<EDTK_MAIL_REFER>, C<EDTK_MAIL_OMGR> | ||||||||||||||||||||||||||||||||||||||||||
| 494 | |||||||||||||||||||||||||||||||||||||||||||
| 495 | Body templates of the recap and outgoing mail. | ||||||||||||||||||||||||||||||||||||||||||
| 496 | |||||||||||||||||||||||||||||||||||||||||||
| 497 | =item C<EDTK_MAIL_LIST_1> through C<EDTK_MAIL_LIST_5> | ||||||||||||||||||||||||||||||||||||||||||
| 498 | |||||||||||||||||||||||||||||||||||||||||||
| 499 | Named distribution lists. | ||||||||||||||||||||||||||||||||||||||||||
| 500 | |||||||||||||||||||||||||||||||||||||||||||
| 501 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 502 | |||||||||||||||||||||||||||||||||||||||||||
| 503 | =head2 The C<[COMPO]> section | ||||||||||||||||||||||||||||||||||||||||||
| 504 | |||||||||||||||||||||||||||||||||||||||||||
| 505 | The LaTeX back-end. | ||||||||||||||||||||||||||||||||||||||||||
| 506 | |||||||||||||||||||||||||||||||||||||||||||
| 507 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 508 | |||||||||||||||||||||||||||||||||||||||||||
| 509 | =item C<EDTK_BIN_COMPO> | ||||||||||||||||||||||||||||||||||||||||||
| 510 | |||||||||||||||||||||||||||||||||||||||||||
| 511 | Directory holding the TeX binaries. | ||||||||||||||||||||||||||||||||||||||||||
| 512 | |||||||||||||||||||||||||||||||||||||||||||
| 513 | =item C<EDTK_COMPO> | ||||||||||||||||||||||||||||||||||||||||||
| 514 | |||||||||||||||||||||||||||||||||||||||||||
| 515 | The composition command, e.g. C<pdflatex -halt-on-error>. | ||||||||||||||||||||||||||||||||||||||||||
| 516 | |||||||||||||||||||||||||||||||||||||||||||
| 517 | =item C<EDTK_COMPO_CMD_PDF>, C<EDTK_COMPO_CMD_DVI>, C<EDTK_COMPO_CMD_DVIPDF> | ||||||||||||||||||||||||||||||||||||||||||
| 518 | |||||||||||||||||||||||||||||||||||||||||||
| 519 | Per-format composition commands. | ||||||||||||||||||||||||||||||||||||||||||
| 520 | |||||||||||||||||||||||||||||||||||||||||||
| 521 | =item C<EDTK_COMPO_LIB> | ||||||||||||||||||||||||||||||||||||||||||
| 522 | |||||||||||||||||||||||||||||||||||||||||||
| 523 | Path to the F<edtkdoc.cls> class file. | ||||||||||||||||||||||||||||||||||||||||||
| 524 | |||||||||||||||||||||||||||||||||||||||||||
| 525 | =item C<EDTK_FILIERES_RECTO_VERSO> | ||||||||||||||||||||||||||||||||||||||||||
| 526 | |||||||||||||||||||||||||||||||||||||||||||
| 527 | Channels whose index is padded to an even page count; empty means none. | ||||||||||||||||||||||||||||||||||||||||||
| 528 | |||||||||||||||||||||||||||||||||||||||||||
| 529 | =item C<EDTK_CMD_RUN_BG_NOWAIT> | ||||||||||||||||||||||||||||||||||||||||||
| 530 | |||||||||||||||||||||||||||||||||||||||||||
| 531 | Non-blocking background composition; empty is blocking, a set value is non-blocking. | ||||||||||||||||||||||||||||||||||||||||||
| 532 | |||||||||||||||||||||||||||||||||||||||||||
| 533 | =item C<EDTK_LINE_CUTOFF> | ||||||||||||||||||||||||||||||||||||||||||
| 534 | |||||||||||||||||||||||||||||||||||||||||||
| 535 | Maximum number of characters before a newline in generated documents; empty falls back to | ||||||||||||||||||||||||||||||||||||||||||
| 536 | C<120>. | ||||||||||||||||||||||||||||||||||||||||||
| 537 | |||||||||||||||||||||||||||||||||||||||||||
| 538 | =item C<EDTK_RP_KILL_NON_LATIN> | ||||||||||||||||||||||||||||||||||||||||||
| 539 | |||||||||||||||||||||||||||||||||||||||||||
| 540 | Strip the non-Latin-1 (DEL and C1) characters from input records; off by default. | ||||||||||||||||||||||||||||||||||||||||||
| 541 | |||||||||||||||||||||||||||||||||||||||||||
| 542 | =item C<EDTK_IDLDOC_FORMAT> | ||||||||||||||||||||||||||||||||||||||||||
| 543 | |||||||||||||||||||||||||||||||||||||||||||
| 544 | Document batch-id format: C<UUID> (the default, a 36-character UUID), or C<LEGACY> / C<old> | ||||||||||||||||||||||||||||||||||||||||||
| 545 | (the 16-digit id, case-insensitive). | ||||||||||||||||||||||||||||||||||||||||||
| 546 | |||||||||||||||||||||||||||||||||||||||||||
| 547 | =item C<EDTK_COMPO_ASYNC> | ||||||||||||||||||||||||||||||||||||||||||
| 548 | |||||||||||||||||||||||||||||||||||||||||||
| 549 | Asynchronous composition; commented out in the template, C<yes> or C<no>. | ||||||||||||||||||||||||||||||||||||||||||
| 550 | |||||||||||||||||||||||||||||||||||||||||||
| 551 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 552 | |||||||||||||||||||||||||||||||||||||||||||
| 553 | =head2 The C<[EDOCMNGR]> section | ||||||||||||||||||||||||||||||||||||||||||
| 554 | |||||||||||||||||||||||||||||||||||||||||||
| 555 | EDMS/GED indexing and transfer. | ||||||||||||||||||||||||||||||||||||||||||
| 556 | |||||||||||||||||||||||||||||||||||||||||||
| 557 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 558 | |||||||||||||||||||||||||||||||||||||||||||
| 559 | =item C<EDMS_INDEX_COLS> | ||||||||||||||||||||||||||||||||||||||||||
| 560 | |||||||||||||||||||||||||||||||||||||||||||
| 561 | Columns of the EDMS index. | ||||||||||||||||||||||||||||||||||||||||||
| 562 | |||||||||||||||||||||||||||||||||||||||||||
| 563 | =item C<EDMS_DATE_FORMAT> | ||||||||||||||||||||||||||||||||||||||||||
| 564 | |||||||||||||||||||||||||||||||||||||||||||
| 565 | Date format used in the index; C<%Y/%m/%d>. | ||||||||||||||||||||||||||||||||||||||||||
| 566 | |||||||||||||||||||||||||||||||||||||||||||
| 567 | =item C<EDMS_IDX_FORMAT> | ||||||||||||||||||||||||||||||||||||||||||
| 568 | |||||||||||||||||||||||||||||||||||||||||||
| 569 | Index format: C<DOCUBASE> (the default) or C<SCOPMASTER>. | ||||||||||||||||||||||||||||||||||||||||||
| 570 | |||||||||||||||||||||||||||||||||||||||||||
| 571 | =item C<EDMS_IDX_HEADER> | ||||||||||||||||||||||||||||||||||||||||||
| 572 | |||||||||||||||||||||||||||||||||||||||||||
| 573 | Index header line, C<;>-separated. | ||||||||||||||||||||||||||||||||||||||||||
| 574 | |||||||||||||||||||||||||||||||||||||||||||
| 575 | =item C<EDMS_ACTIVATE_HEADER_ALFRESCO> | ||||||||||||||||||||||||||||||||||||||||||
| 576 | |||||||||||||||||||||||||||||||||||||||||||
| 577 | Emit the Alfresco header line; C<YES> or C<NO>. | ||||||||||||||||||||||||||||||||||||||||||
| 578 | |||||||||||||||||||||||||||||||||||||||||||
| 579 | =item C<EDMS_FTP_HOST>, C<EDMS_FTP_PORT>, C<EDMS_FTP_USER>, C<EDMS_FTP_PASS> | ||||||||||||||||||||||||||||||||||||||||||
| 580 | |||||||||||||||||||||||||||||||||||||||||||
| 581 | FTP(S) transfer target. | ||||||||||||||||||||||||||||||||||||||||||
| 582 | |||||||||||||||||||||||||||||||||||||||||||
| 583 | =item C<EDMS_FTP_DIR_IDX>, C<EDMS_FTP_DIR_DOCS> | ||||||||||||||||||||||||||||||||||||||||||
| 584 | |||||||||||||||||||||||||||||||||||||||||||
| 585 | Remote index and document directories. | ||||||||||||||||||||||||||||||||||||||||||
| 586 | |||||||||||||||||||||||||||||||||||||||||||
| 587 | =item C<EDTK_EDOCS_LINK> | ||||||||||||||||||||||||||||||||||||||||||
| 588 | |||||||||||||||||||||||||||||||||||||||||||
| 589 | Base URL of the document link. | ||||||||||||||||||||||||||||||||||||||||||
| 590 | |||||||||||||||||||||||||||||||||||||||||||
| 591 | =item C<EDMS_HTML_HOST> | ||||||||||||||||||||||||||||||||||||||||||
| 592 | |||||||||||||||||||||||||||||||||||||||||||
| 593 | HTML host used to build the lookup URL. | ||||||||||||||||||||||||||||||||||||||||||
| 594 | |||||||||||||||||||||||||||||||||||||||||||
| 595 | =item C<EDMS_URL_LOOKUP> | ||||||||||||||||||||||||||||||||||||||||||
| 596 | |||||||||||||||||||||||||||||||||||||||||||
| 597 | Lookup URL template, with C<%s> and C<%d> placeholders. | ||||||||||||||||||||||||||||||||||||||||||
| 598 | |||||||||||||||||||||||||||||||||||||||||||
| 599 | =item C<EDMS_BIN_GS>, C<EDMS_BIN_PDFTK> | ||||||||||||||||||||||||||||||||||||||||||
| 600 | |||||||||||||||||||||||||||||||||||||||||||
| 601 | Ghostscript and pdftk binaries. | ||||||||||||||||||||||||||||||||||||||||||
| 602 | |||||||||||||||||||||||||||||||||||||||||||
| 603 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 604 | |||||||||||||||||||||||||||||||||||||||||||
| 605 | =head2 The C<[SERVICES]> section | ||||||||||||||||||||||||||||||||||||||||||
| 606 | |||||||||||||||||||||||||||||||||||||||||||
| 607 | Optional network services. All are inactive by default: an empty value keeps the mainline | ||||||||||||||||||||||||||||||||||||||||||
| 608 | behaviour. | ||||||||||||||||||||||||||||||||||||||||||
| 609 | |||||||||||||||||||||||||||||||||||||||||||
| 610 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 611 | |||||||||||||||||||||||||||||||||||||||||||
| 612 | =item C<NWS_EMAILING_URI> | ||||||||||||||||||||||||||||||||||||||||||
| 613 | |||||||||||||||||||||||||||||||||||||||||||
| 614 | E-mailing service base URL; empty means unused (C</emails> is appended). | ||||||||||||||||||||||||||||||||||||||||||
| 615 | |||||||||||||||||||||||||||||||||||||||||||
| 616 | =item C<EMAILING_TEMPLATE>, C<EMAILING_USER_AGENT> | ||||||||||||||||||||||||||||||||||||||||||
| 617 | |||||||||||||||||||||||||||||||||||||||||||
| 618 | E-mailing template name and User-Agent string; empty falls back to each client's shipped | ||||||||||||||||||||||||||||||||||||||||||
| 619 | default. | ||||||||||||||||||||||||||||||||||||||||||
| 620 | |||||||||||||||||||||||||||||||||||||||||||
| 621 | =item C<KEYCLOAK_URL>, C<KEYCLOAK_CLIENT_ID>, C<KEYCLOAK_SECRET_ID> | ||||||||||||||||||||||||||||||||||||||||||
| 622 | |||||||||||||||||||||||||||||||||||||||||||
| 623 | Keycloak token endpoint and client credentials; all three are required together. | ||||||||||||||||||||||||||||||||||||||||||
| 624 | |||||||||||||||||||||||||||||||||||||||||||
| 625 | =item C<KEYCLOAK_REALM> | ||||||||||||||||||||||||||||||||||||||||||
| 626 | |||||||||||||||||||||||||||||||||||||||||||
| 627 | Keycloak realm path element; empty uses the client's shipped default. | ||||||||||||||||||||||||||||||||||||||||||
| 628 | |||||||||||||||||||||||||||||||||||||||||||
| 629 | =item C<DISSEMINATION_PLAN_URL> | ||||||||||||||||||||||||||||||||||||||||||
| 630 | |||||||||||||||||||||||||||||||||||||||||||
| 631 | Dissemination-plan service URL; empty skips the step. | ||||||||||||||||||||||||||||||||||||||||||
| 632 | |||||||||||||||||||||||||||||||||||||||||||
| 633 | =item C<EDTK_SSL_VERIFY> | ||||||||||||||||||||||||||||||||||||||||||
| 634 | |||||||||||||||||||||||||||||||||||||||||||
| 635 | TLS peer and host-name verification: C<1> (the default, safe) or C<0> for a service fronted | ||||||||||||||||||||||||||||||||||||||||||
| 636 | by a private CA. | ||||||||||||||||||||||||||||||||||||||||||
| 637 | |||||||||||||||||||||||||||||||||||||||||||
| 638 | =item C<EDTK_SSL_CA_PATH> | ||||||||||||||||||||||||||||||||||||||||||
| 639 | |||||||||||||||||||||||||||||||||||||||||||
| 640 | CA bundle, a file or a directory; empty uses the system trust store. | ||||||||||||||||||||||||||||||||||||||||||
| 641 | |||||||||||||||||||||||||||||||||||||||||||
| 642 | =item C<EDTK_ACQUIT_API> | ||||||||||||||||||||||||||||||||||||||||||
| 643 | |||||||||||||||||||||||||||||||||||||||||||
| 644 | Named acquittal callable, C<Module::function>; empty means no API acquittal. | ||||||||||||||||||||||||||||||||||||||||||
| 645 | |||||||||||||||||||||||||||||||||||||||||||
| 646 | =item C<EDTK_MAIL_ACQ> | ||||||||||||||||||||||||||||||||||||||||||
| 647 | |||||||||||||||||||||||||||||||||||||||||||
| 648 | Recipients of the acquittal recap report; empty means no report. | ||||||||||||||||||||||||||||||||||||||||||
| 649 | |||||||||||||||||||||||||||||||||||||||||||
| 650 | =item C<APIECM_URL>, C<APIECM_APIKEY_EDITIQUE> | ||||||||||||||||||||||||||||||||||||||||||
| 651 | |||||||||||||||||||||||||||||||||||||||||||
| 652 | ECM API base URL and the static editique API key; empty leaves the ECM injector unusable. | ||||||||||||||||||||||||||||||||||||||||||
| 653 | |||||||||||||||||||||||||||||||||||||||||||
| 654 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 655 | |||||||||||||||||||||||||||||||||||||||||||
| 656 | =head2 The host-name section | ||||||||||||||||||||||||||||||||||||||||||
| 657 | |||||||||||||||||||||||||||||||||||||||||||
| 658 | A worked example of an override section, whose name is always uppercase. A section matching | ||||||||||||||||||||||||||||||||||||||||||
| 659 | C<uc(hostname())> is merged last, so it wins, and its C<iniEdtk> key can redirect the whole | ||||||||||||||||||||||||||||||||||||||||||
| 660 | read. | ||||||||||||||||||||||||||||||||||||||||||
| 661 | |||||||||||||||||||||||||||||||||||||||||||
| 662 | A few keys the code reads are not shipped in the template and stay optional: C<EDTK_DICO_COUNTRY> | ||||||||||||||||||||||||||||||||||||||||||
| 663 | (the country dictionary), C<EDTK_DICO_XLAT> (LaTeX character translation), | ||||||||||||||||||||||||||||||||||||||||||
| 664 | C<EDTK_XML_CATALOG_FILES> (XML catalogs, read from the C<[MAIL]> section), | ||||||||||||||||||||||||||||||||||||||||||
| 665 | C<EDTK_DB_STORAGE_ENGINE> (the MySQL storage engine, C<MyISAM> by default), and | ||||||||||||||||||||||||||||||||||||||||||
| 666 | C<EDTK_ENTIRE_YEARS_KEPT> / C<EDTK_STATS_DAYS_FROM> (retention and history windows). | ||||||||||||||||||||||||||||||||||||||||||
| 667 | |||||||||||||||||||||||||||||||||||||||||||
| 668 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||
| 669 | |||||||||||||||||||||||||||||||||||||||||||
| 670 | The oEdtk team. | ||||||||||||||||||||||||||||||||||||||||||
| 671 | |||||||||||||||||||||||||||||||||||||||||||
| 672 | =cut | ||||||||||||||||||||||||||||||||||||||||||