mirror of
				https://github.com/appleboy/drone-ssh.git
				synced 2025-10-29 00:51:15 +08:00 
			
		
		
		
	refactor: set default environment variables format in plugin
- Add `INPUT_ENVS_FORMAT` to the list of environment variables in `main.go` - Define `envsFormat` variable in `plugin.go` - Add default value for `Config.EnvsFormat` in `plugin.go` `Exec()` function Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
		
							parent
							
								
									6464d9999f
								
							
						
					
					
						commit
						46f9096787
					
				
							
								
								
									
										4
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								main.go
									
									
									
									
									
								
							| @ -199,8 +199,8 @@ func main() { | ||||
| 		&cli.StringFlag{ | ||||
| 			Name:    "envs.format", | ||||
| 			Usage:   "", | ||||
| 			EnvVars: []string{"PLUGIN_ENVS_FORMAT"}, | ||||
| 			Value:   "export {NAME}={VALUE}", | ||||
| 			EnvVars: []string{"PLUGIN_ENVS_FORMAT", "INPUT_ENVS_FORMAT"}, | ||||
| 			Value:   envsFormat, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
|  | ||||
| @ -17,6 +17,7 @@ var ( | ||||
| 	errMissingHost          = errors.New("Error: missing server host") | ||||
| 	errMissingPasswordOrKey = errors.New("Error: can't connect without a private SSH key or password") | ||||
| 	errCommandTimeOut       = errors.New("Error: command timeout") | ||||
| 	envsFormat              = "export {NAME}={VALUE}" | ||||
| ) | ||||
| 
 | ||||
| type ( | ||||
| @ -179,6 +180,10 @@ func (p Plugin) Exec() error { | ||||
| 		return errMissingPasswordOrKey | ||||
| 	} | ||||
| 
 | ||||
| 	if p.Config.EnvsFormat == "" { | ||||
| 		p.Config.EnvsFormat = envsFormat | ||||
| 	} | ||||
| 
 | ||||
| 	wg := sync.WaitGroup{} | ||||
| 	wg.Add(len(p.Config.Host)) | ||||
| 	errChannel := make(chan error) | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Bo-Yi Wu
						Bo-Yi Wu