blib/lib/Google/Auth/EnvironmentVars.pm

filter: Statementstmt 100% 30 / 30 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 12 / 12 Podpod n/a totaltotal 100% 42 / 42 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« XS.xs ↑ Summary
1 # Copyright 2022 Google LLC and contributors
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14  
15 package Google::Auth::EnvironmentVars;
16  
17 14 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 14 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 14 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 14 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23 =head1 NAME
24  
25 Google::Auth::EnvironmentVars - Environment variables used by Google::Auth
26  
27 =head1 VERSION
28  
29 Version 0.15
30  
31 =head1 SYNOPSIS
32  
33 use Google::Auth::EnvironmentVars;
34  
35 my $env = Google::Auth::EnvironmentVars->new();
36 my $project = $env->PROJECT;
37 my $creds_path = $env->CREDENTIALS;
38  
39 =head1 DESCRIPTION
40  
41 C<Google::Auth::EnvironmentVars> provides a canonical Moo-based accessor
42 class for reading the standard Google Cloud authentication and project
43 environment variables (such as C<GOOGLE_APPLICATION_CREDENTIALS>,
44 C<GOOGLE_CLOUD_PROJECT>, and C<CLOUDSDK_CONFIG>) used by L<Google::Auth>.
45  
46 =head1 METHODS
47  
48 =head2 PROJECT
49  
50 This env variable is used by Google::Auth to explicitly set a project
51 ID. This environment variable is also used by the Google Cloud Perl
52 Library.
53  
54 =cut
55  
56 has PROJECT => (
57 is => 'ro',
58 1 ▶ builder => sub { $ENV{GOOGLE_CLOUD_PROJECT} },
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine _build_PROJECT: called CC=1 SCAR=0.0
59 12 documentation => 'Environment variable defining default project',
60 );
61  
62 =head2 LEGACY_PROJECT
63  
64 This environment variable is used instead of the current one in some
65 situations (such as Google App Engine).
66  
67 =cut
68  
69 has LEGACY_PROJECT => (
70 is => 'ro',
71 7 ▶ builder => sub { $ENV{GCLOUD_PROJECT} },
Subroutine _build_LEGACY_PROJECT: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
72 12 documentation =>
73 'Previously used environment variable defining the default project',
74 );
75  
76 =head2 CREDENTIALS
77  
78 Environment variable defining the location of Google application
79 default credentials
80  
81 =cut
82  
83 has CREDENTIALS => (
84 is => 'ro',
85 10 ▶ builder => sub { $ENV{GOOGLE_APPLICATION_CREDENTIALS} },
Subroutine _build_CREDENTIALS: called CC=1 SCAR=0.0
86 12 documentation =>
87 'Environment variable defining the location of Google application default credentials',
88 );
89  
90 =head2 CLOUD_SDK_CONFIG_DIR
91  
92 The environment variable name which can replace ~/.config if set
93  
94 =cut
95  
96 has CLOUD_SDK_CONFIG_DIR => (
97 is => 'ro',
98 11 ▶ builder => sub { $ENV{CLOUDSDK_CONFIG} },
Subroutine _build_CLOUD_SDK_CONFIG_DIR: called CC=1 SCAR=0.0
99 12 documentation =>
100 q{Environment variable defines the location of Google Cloud SDK's config files},
101 );
102  
103 =head2 GCE_METADATA_ROOT
104  
105 This and the following variable allow for customization of the
106 addresses used when contacting the GCE metadata service.
107  
108 =cut
109  
110 has GCE_METADATA_ROOT => (
111 is => 'ro',
112 5 ▶ builder => sub { $ENV{GCE_METADATA_ROOT} },
Subroutine _build_GCE_METADATA_ROOT: called CC=1 SCAR=0.0
113 12 documentation =>
114 'Environment variable providing an alternate hostname or host:port to be '
115 . 'used for GCE metadata requests',
116 );
117  
118 =head2 GCE_METADATA_IP
119  
120 =cut
121  
122 has GCE_METADATA_IP => (
123 is => 'ro',
124 9 ▶ builder => sub { $ENV{GCE_METADATA_IP} },
Subroutine _build_GCE_METADATA_IP: called CC=1 SCAR=0.0
125 12 documentation =>
126 'Environment variable providing an alternate ip:port to be used for ip-only '
127 . 'GCE metadata requests',
128 );
129  
130 =head1 AUTHOR
131  
132 C.J. Collier, C<< <cjac at google.com> >>
133  
134 =head1 BUGS AND SUPPORT
135  
136 Please report any bugs or feature requests to the GitHub issue tracker at
137 L<https://github.com/GoogleCloudPlatform/google-auth-library-perl/issues> or via RT at
138 L<https://rt.cpan.org/Dist/Display.html?Name=Google-Auth>.
139  
140 You can also look for information at:
141  
142 =over 4
143  
144 =item * GitHub Issue Tracker
145  
146 L<https://github.com/GoogleCloudPlatform/google-auth-library-perl/issues>
147  
148 =item * RT: CPAN's Request Tracker
149  
150 L<https://rt.cpan.org/Dist/Display.html?Name=Google-Auth>
151  
152 =item * MetaCPAN
153  
154 L<https://metacpan.org/release/Google-Auth>
155  
156 =back
157  
158  
159 =head1 ACKNOWLEDGEMENTS
160  
161  
162 =head1 LICENSE AND COPYRIGHT
163  
164 Copyright 2020 Google LLC and contributors
165  
166 This program is released under the following license: Apache 2.0
167  
168  
169 =cut
170  
171 12 1; # End of Google::Auth
« XS.xs ↑ Summary