@@ -26,18 +26,12 @@ export const command = new Command("functions:artifacts:setpolicy")
26
26
)
27
27
. option (
28
28
"--days <days>" ,
29
- "Number of days to keep container images before deletion. Default is 3 days." ,
30
- "3" ,
29
+ `Number of days to keep container images before deletion. Default is ${ artifacts . DEFAULT_CLEANUP_DAYS } day.` ,
31
30
)
32
31
. option (
33
32
"--none" ,
34
33
"Opt-out from cleanup policy. This will prevent suggestions to set up a cleanup policy during initialization and deployment." ,
35
34
)
36
- . before ( ( options ) => {
37
- if ( options . days && options . none ) {
38
- throw new FirebaseError ( "Cannot specify both --days and --none options." ) ;
39
- }
40
- } )
41
35
. withForce ( "Automatically create or modify cleanup policy" )
42
36
. before ( requireAuth )
43
37
. before ( async ( options ) => {
@@ -49,9 +43,12 @@ export const command = new Command("functions:artifacts:setpolicy")
49
43
"artifactregistry.versions.delete" ,
50
44
] )
51
45
. action ( async ( options : any ) => {
46
+ if ( options . days && options . none ) {
47
+ throw new FirebaseError ( "Cannot specify both --days and --none options." ) ;
48
+ }
52
49
const projectId = needProjectId ( options ) ;
53
50
const location = options . location || "us-central1" ;
54
- let daysToKeep = parseInt ( options . days || "3" , 10 ) ;
51
+ let daysToKeep = parseInt ( options . days || artifacts . DEFAULT_CLEANUP_DAYS , 10 ) ;
55
52
56
53
const repoPath = artifacts . makeRepoPath ( projectId , location ) ;
57
54
let repository : artifactregistry . Repository ;
0 commit comments