blib/lib/Yukki/Settings.pm

filter: Statementstmt 98.0% 49 / 50 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 92.3% 12 / 13 Podpod n/a totaltotal 96.8% 61 / 63 SCAR 0.0
CC
1
Cov
98%
__ANON__
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« bin/yukki-git-init ↑ Summary bin/yukki-add-user »
1 package Yukki::Settings;
2 13 $Yukki::Settings::VERSION = '0.991_002'; # TRIAL
3  
4 13 ▶$Yukki::Settings::VERSION = '0.991002';use v5.24;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 13 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 13 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 13 ▶use Types::Path::Tiny qw( Path );
Subroutine BEGIN: called CC=1 SCAR=0.0
9 13 ▶use Types::Standard qw( Str );
Subroutine BEGIN: called CC=1 SCAR=0.0
10 13 ▶use Yukki::Settings::Repository;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 13 ▶use Yukki::Types qw( PrivilegesMap RepositoryMap YukkiSettingsAnonymous );
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 13 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 # ABSTRACT: provides structure and validation to settings in yukki.conf
16  
17  
18 13 has root => (
19 is => 'ro',
20 isa => Path,
21 required => 1,
22 coerce => 1,
23 default => '.',
24 );
25  
26  
27 13 has repository_path => (
28 is => 'ro',
29 isa => Path,
30 required => 1,
31 coerce => 1,
32 default => 'repositories',
33 );
34  
35  
36 13 has user_path => (
37 is => 'ro',
38 isa => Path,
39 required => 1,
40 coerce => 1,
41 default => 'var/db/users',
42 );
43  
44  
45 13 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 0 ▶ default => sub { Yukki::Settings::Anonymous->new },
Subroutine __ANON__: not called CC=1 SCAR=6.9
59 13 );
60  
61  
62 13 has repo_path => (
63 is => 'ro',
64 isa => Path,
65 required => 1,
66 coerce => 1,
67 default => 'var/db/repos',
68 );
69  
70  
71 13 has repositories => (
72 is => 'ro',
73 isa => RepositoryMap,
74 required => 1,
75 coerce => 1,
76 );
77  
78 {
79 13 package Yukki::Settings::Anonymous;
80 13 $Yukki::Settings::Anonymous::VERSION = '0.991_002'; # TRIAL
81  
82 13 ▶$Yukki::Settings::Anonymous::VERSION = '0.991002';use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
83 13 ▶ use Types::Standard qw( Str );
Subroutine BEGIN: called CC=1 SCAR=0.0
84 13 ▶ use Yukki::Types qw( EmailAddress );
Subroutine BEGIN: called CC=1 SCAR=0.0
85  
86 13 has author_name => (
87 is => 'ro',
88 isa => Str,
89 required => 1,
90 default => 'Anonymous',
91 );
92  
93 13 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 1 ▶ default => sub { +{} },
Subroutine __ANON__: called CC=1 SCAR=0.0
109 13 );
110  
111 13 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
« bin/yukki-git-init ↑ Summary bin/yukki-add-user »