| 1 | package Net::ACME2::LetsEncrypt; | ||||||||||||||
| 2 | |||||||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 5 | |||||||||||||||
| 6 | 1 | ▶ | use parent qw( Net::ACME2 ); | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 7 | |||||||||||||||
| 8 | =encoding utf-8 | ||||||||||||||
| 9 | |||||||||||||||
| 10 | =head1 NAME | ||||||||||||||
| 11 | |||||||||||||||
| 12 | Net::ACME2::LetsEncrypt - Letâs Encryptâs v2 API endpoint | ||||||||||||||
| 13 | |||||||||||||||
| 14 | =head1 SYNOPSIS | ||||||||||||||
| 15 | |||||||||||||||
| 16 | my $acme = Net::ACME2::LetsEncrypt->new( | ||||||||||||||
| 17 | |||||||||||||||
| 18 | environment => 'staging', #default: âproductionâ | ||||||||||||||
| 19 | |||||||||||||||
| 20 | # ... and other arg(s) as described in Net::ACME2 | ||||||||||||||
| 21 | ); | ||||||||||||||
| 22 | |||||||||||||||
| 23 | See L<Net::ACME2> for usage examples. | ||||||||||||||
| 24 | |||||||||||||||
| 25 | =head1 STAGING VS. PRODUCTION | ||||||||||||||
| 26 | |||||||||||||||
| 27 | This classâs constructor accepts an optional C<environment> parameter. | ||||||||||||||
| 28 | If you set this to C<staging>, youâll get | ||||||||||||||
| 29 | L<Letâs Encryptâs staging server|https://letsencrypt.org/docs/staging-environment/> | ||||||||||||||
| 30 | rather than the (default) C<production> server. | ||||||||||||||
| 31 | |||||||||||||||
| 32 | =cut | ||||||||||||||
| 33 | |||||||||||||||
| 34 | use constant { | ||||||||||||||
| 35 | 1 | DIRECTORY_PATH => '/directory', | |||||||||||||
| 36 | |||||||||||||||
| 37 | _STAGING_SERVER => 'acme-staging-v02.api.letsencrypt.org', | ||||||||||||||
| 38 | _PRODUCTION_SERVER => 'acme-v02.api.letsencrypt.org', | ||||||||||||||
| 39 | 1 | ▶ | }; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 40 | |||||||||||||||
| 41 | sub HOST { | ||||||||||||||
| 42 | 1 | ▶ | my ($class, %opts) = @_; | ||||||||||||
|
Subroutine
HOST: called CC=4 SCAR=21.7
Pod
undocumented
| |||||||||||||||
| 43 | |||||||||||||||
| 44 | 1 | ▶ | if ( my $env = $opts{'environment'} ) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 45 | 0 | ▶ | if ($env eq 'staging') { | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 46 | 0 | return _STAGING_SERVER(); | |||||||||||||
| 47 | } | ||||||||||||||
| 48 | elsif ($env ne 'production') { | ||||||||||||||
| 49 | 0 | die "Invalid âenvironmentâ! ($env)"; | |||||||||||||
| 50 | } | ||||||||||||||
| 51 | } | ||||||||||||||
| 52 | |||||||||||||||
| 53 | 1 | return _PRODUCTION_SERVER(); | |||||||||||||
| 54 | } | ||||||||||||||
| 55 | |||||||||||||||
| 56 | 1 | 1; | |||||||||||||