File Coverage

blib/lib/Yukki/Settings.pm
Criterion Covered Total %
statement 32 32 100.0
branch n/a
condition n/a
subroutine 11 11 100.0
pod n/a
total 43 43 100.0


line stmt bran cond sub pod time code
1             package Yukki::Settings;
2             $Yukki::Settings::VERSION = '0.991_002'; # TRIAL
3              
4 3     3   39 $Yukki::Settings::VERSION = '0.991002';use v5.24;
  3         11  
5 3     3   17 use utf8;
  3         6  
  3         26  
6 3     3   62 use Moo;
  3         19  
  3         20  
7              
8 3     3   1650 use Types::Path::Tiny qw( Path );
  3         274153  
  3         37  
9 3     3   1707 use Types::Standard qw( Str );
  3         7  
  3         38  
10 3     3   3386 use Yukki::Settings::Repository;
  3         16  
  3         202  
11 3     3   33 use Yukki::Types qw( PrivilegesMap RepositoryMap YukkiSettingsAnonymous );
  3         5  
  3         28  
12              
13 3     3   2151 use namespace::clean;
  3         8  
  3         38  
14              
15             # ABSTRACT: provides structure and validation to settings in yukki.conf
16              
17              
18             has root => (
19             is => 'ro',
20             isa => Path,
21             required => 1,
22             coerce => 1,
23             default => '.',
24             );
25              
26              
27             has repository_path => (
28             is => 'ro',
29             isa => Path,
30             required => 1,
31             coerce => 1,
32             default => 'repositories',
33             );
34              
35              
36             has user_path => (
37             is => 'ro',
38             isa => Path,
39             required => 1,
40             coerce => 1,
41             default => 'var/db/users',
42             );
43              
44              
45             has digest => (
46             is => 'ro',
47             isa => Str,
48             required => 1,
49             default => 'SHA-512',
50             );
51              
52              
53             has anonymous => (
54             is => 'ro',
55             isa => YukkiSettingsAnonymous,
56             required => 1,
57             coerce => 1,
58             default => sub { Yukki::Settings::Anonymous->new },
59             );
60              
61              
62             has repo_path => (
63             is => 'ro',
64             isa => Path,
65             required => 1,
66             coerce => 1,
67             default => 'var/db/repos',
68             );
69              
70              
71             has repositories => (
72             is => 'ro',
73             isa => RepositoryMap,
74             required => 1,
75             coerce => 1,
76             );
77              
78             {
79             package Yukki::Settings::Anonymous;
80             $Yukki::Settings::Anonymous::VERSION = '0.991_002'; # TRIAL
81              
82 3     3   1619 $Yukki::Settings::Anonymous::VERSION = '0.991002';use Moo;
  3         7  
  3         17  
83 3     3   1043 use Types::Standard qw( Str );
  3         7  
  3         26  
84 3     3   2071 use Yukki::Types qw( EmailAddress );
  3         9  
  3         13  
85              
86             has author_name => (
87             is => 'ro',
88             isa => Str,
89             required => 1,
90             default => 'Anonymous',
91             );
92              
93             has author_email => (
94             is => 'ro',
95             isa => EmailAddress,
96             required => 1,
97             coerce => 1,
98             default => 'anonymous@localhost',
99             );
100             }
101              
102              
103             has special_privileges => (
104             is => 'ro',
105             isa => PrivilegesMap,
106             required => 1,
107             coerce => 1,
108             default => sub { +{} },
109             );
110              
111             1;
112              
113             __END__
114              
115             =pod
116              
117             =encoding UTF-8
118              
119             =head1 NAME
120              
121             Yukki::Settings - provides structure and validation to settings in yukki.conf
122              
123             =head1 VERSION
124              
125             version 0.991_002
126              
127             =head1 DESCRIPTION
128              
129             This class provides structure for the main application configuration in L<Yukki>.
130              
131             Yukki may fail to start unless your configuration is correct.
132              
133             =head1 ATTRIBUTES
134              
135             =head2 root
136              
137             This is the wiki site directory. This should be the same folder that was given the F<yukki-setup> command. It works best if you make this an absolute path.
138              
139             =head2 repository_path
140              
141             This is the folder where Yukki will find the git repositories installed under C<root>. The default is F<root/repositories>.
142              
143             =head2 user_path
144              
145             This is the folder where the list of user files can be found.
146              
147             =head2 digest
148              
149             This is the name of the digest algorithm to use to store passwords. See L<Digest> for more information. The default is "SHA-512".
150              
151             N.B. If you change digest algorithms, old passwords saved with the old digest algorithm will continue to work as long as the old digest algorithm class is still installed.
152              
153             =head2 anonymous
154              
155             This is a section configuring anonymous user information.
156              
157             =over
158              
159             =item author_name
160              
161             This is the name to use when an anonymous user makes a change to a wiki repository.
162              
163             =item author_email
164              
165             This is the email address to use when an anonymous user makes a change to a wiki repository.
166              
167             =back
168              
169             =head2 repo_path
170              
171             This is the folder where repository configuraiton files can be found. This path is intended for application managed repository configuration files. If you want to manage your repositories from the command-line instead, store the repository configurations under the C<repository> key in the main settings file.
172              
173             =head2 repositories
174              
175             This is a section under which each repository is configured. The keys under here are the name found in the URL. It is also the name to use when running the F<yukki-git-init> and other repository-related commands.
176              
177             Repository configurations may be stored either in the main Yukki configuration file under the C<repositories> key or as individual files located in the directory named in the C<repo_path> key. If a configuration is named in both places, the one in the main settings file will always be used.
178              
179             Each repository configuration should provide the following configruation keys.
180              
181             =head2 special_privileges
182              
183             This section of the settings configures which groups grant special privileges. These special privileges grant access to view or change the configuration from within the application. By default, no one has these privileges, effectively disabling any in-app administrative features.
184              
185             The grants for each here are identical to that available to repositories:
186              
187             =over
188              
189             =item anonymous_access_level
190              
191             This names the access level anonymous users have. Obviously, it would generally be unwise for this to be anything but "none" for adminsitrative functions, but "read" and "write" are other possible values.
192              
193             =item read_groups
194              
195             Names the list of groups that are granted permission to perform read-only actions. This may also be set to "ANY" to specify that any logged user may perform this action or "NONE" to specify that no logged user may perform this action.
196              
197             =item write_groups
198              
199             Names the list of groups that are granted permission to perform read-write actions. As with read, this may be set to "ANY" and "NONE" with the same meaning.
200              
201             =back
202              
203             =head1 AUTHOR
204              
205             Andrew Sterling Hanenkamp <hanenkamp@cpan.org>
206              
207             =head1 COPYRIGHT AND LICENSE
208              
209             This software is copyright (c) 2017 by Qubling Software LLC.
210              
211             This is free software; you can redistribute it and/or modify it under
212             the same terms as the Perl 5 programming language system itself.
213              
214             =cut