mirror of
				https://github.com/optim-enterprises-bv/vault.git
				synced 2025-10-30 18:17:55 +00:00 
			
		
		
		
	CLI to take days as a unit of time (#20477)
* CLI to take days as a unit of time * CL
This commit is contained in:
		
							
								
								
									
										3
									
								
								changelog/20477.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								changelog/20477.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,3 @@ | ||||
| ```release-note:bug | ||||
| cli: CLI should take days as a unit of time for ttl like flags | ||||
| ``` | ||||
| @@ -594,7 +594,7 @@ type DurationVar struct { | ||||
| func (f *FlagSet) DurationVar(i *DurationVar) { | ||||
| 	initial := i.Default | ||||
| 	if v, exist := os.LookupEnv(i.EnvVar); exist { | ||||
| 		if d, err := time.ParseDuration(appendDurationSuffix(v)); err == nil { | ||||
| 		if d, err := parseutil.ParseDurationSecond(v); err == nil { | ||||
| 			initial = d | ||||
| 		} | ||||
| 	} | ||||
| @@ -634,7 +634,7 @@ func (d *durationValue) Set(s string) error { | ||||
| 		s = "-1" | ||||
| 	} | ||||
|  | ||||
| 	v, err := time.ParseDuration(appendDurationSuffix(s)) | ||||
| 	v, err := parseutil.ParseDurationSecond(s) | ||||
| 	if err != nil { | ||||
| 		return err | ||||
| 	} | ||||
|   | ||||
| @@ -71,6 +71,12 @@ func TestTokenCreateCommand_Run(t *testing.T) { | ||||
| 			"not present in secret", | ||||
| 			1, | ||||
| 		}, | ||||
| 		{ | ||||
| 			"ttl", | ||||
| 			[]string{"-ttl", "1d", "-explicit-max-ttl", "2d"}, | ||||
| 			"token", | ||||
| 			0, | ||||
| 		}, | ||||
| 	} | ||||
|  | ||||
| 	t.Run("validations", func(t *testing.T) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Hamid Ghaf
					Hamid Ghaf