| 1 | package Yukki::Settings; | ||
| 2 | 19 | $Yukki::Settings::VERSION = '0.991_007'; # TRIAL | |
| 3 | 19 | $Yukki::Settings::VERSION = '0.991007'; | |
| 4 | 19 | ▶ | use v5.24; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 19 | ▶ | use utf8; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 19 | ▶ | use Moo; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | 19 | ▶ | use Types::Path::Tiny qw( Path ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | 19 | ▶ | use Types::Standard qw( Str ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | 19 | ▶ | use Yukki::Settings::Repository; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | 19 | ▶ | use Yukki::Types qw( PrivilegesMap RepositoryMap YukkiSettingsAnonymous ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 12 | |||
| 13 | 19 | ▶ | 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 | 19 | has root => ( | |
| 19 | is => 'ro', | ||
| 20 | isa => Path, | ||
| 21 | required => 1, | ||
| 22 | coerce => 1, | ||
| 23 | default => '.', | ||
| 24 | ); | ||
| 25 | |||
| 26 | |||
| 27 | 19 | has repository_path => ( | |
| 28 | is => 'ro', | ||
| 29 | isa => Path, | ||
| 30 | required => 1, | ||
| 31 | coerce => 1, | ||
| 32 | default => 'repositories', | ||
| 33 | ); | ||
| 34 | |||
| 35 | |||
| 36 | 19 | has user_path => ( | |
| 37 | is => 'ro', | ||
| 38 | isa => Path, | ||
| 39 | required => 1, | ||
| 40 | coerce => 1, | ||
| 41 | default => 'var/db/users', | ||
| 42 | ); | ||
| 43 | |||
| 44 | |||
| 45 | 19 | 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 | 19 | ); | |
| 60 | |||
| 61 | |||
| 62 | 19 | has repo_path => ( | |
| 63 | is => 'ro', | ||
| 64 | isa => Path, | ||
| 65 | required => 1, | ||
| 66 | coerce => 1, | ||
| 67 | default => 'var/db/repos', | ||
| 68 | ); | ||
| 69 | |||
| 70 | |||
| 71 | 19 | has repositories => ( | |
| 72 | is => 'ro', | ||
| 73 | isa => RepositoryMap, | ||
| 74 | required => 1, | ||
| 75 | coerce => 1, | ||
| 76 | ); | ||
| 77 | |||
| 78 | { | ||
| 79 | 19 | package Yukki::Settings::Anonymous; | |
| 80 | 19 | $Yukki::Settings::Anonymous::VERSION = '0.991_007'; # TRIAL | |
| 81 | 19 | $Yukki::Settings::Anonymous::VERSION = '0.991007'; | |
| 82 | 19 | ▶ | use Moo; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 83 | 19 | ▶ | use Types::Standard qw( Str ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 84 | 19 | ▶ | use Yukki::Types qw( EmailAddress ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 85 | |||
| 86 | 19 | has author_name => ( | |
| 87 | is => 'ro', | ||
| 88 | isa => Str, | ||
| 89 | required => 1, | ||
| 90 | default => 'Anonymous', | ||
| 91 | ); | ||
| 92 | |||
| 93 | 19 | 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 | 19 | ); | |
| 110 | |||
| 111 | 19 | 1; | |
| 112 | |||
| 113 | __END__ | ||