mirror of
				https://github.com/fluxcd/flux2.git
				synced 2025-10-31 08:17:19 +08:00 
			
		
		
		
	Avoid overwriting the host port on http requests
Remove the overwrite of the repositoryURL.Host variable to include Git servers deployed on non-standard https ports Co-authored-by: Sebastián Vargas <develolux@gmail.com> Signed-off-by: Alby Hernández <me@achetronic.com> Signed-off-by: Alby Hernández <alby.hernandez@system73.com>
This commit is contained in:
		 Alby Hernández
					Alby Hernández
				
			
				
					committed by
					
						 Hidde Beydals
						Hidde Beydals
					
				
			
			
				
	
			
			
			 Hidde Beydals
						Hidde Beydals
					
				
			
						parent
						
							11081e8cb2
						
					
				
				
					commit
					c190d80d4a
				
			| @ -161,10 +161,15 @@ func bootstrapGitCmdRun(cmd *cobra.Command, args []string) error { | |||||||
| 			secretOpts.CAFilePath = bootstrapArgs.caFile | 			secretOpts.CAFilePath = bootstrapArgs.caFile | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
|  | 		// Remove port of the given host when not syncing over HTTP/S to not assume port for protocol | ||||||
|  | 		// This _might_ be overwritten later on by e.g. --ssh-hostname | ||||||
|  | 		if repositoryURL.Scheme != "https" && repositoryURL.Scheme != "http" { | ||||||
|  | 			repositoryURL.Host = repositoryURL.Hostname() | ||||||
|  | 		} | ||||||
|  |  | ||||||
| 		// Configure repository URL to match auth config for sync. | 		// Configure repository URL to match auth config for sync. | ||||||
| 		repositoryURL.User = nil | 		repositoryURL.User = nil | ||||||
| 		repositoryURL.Scheme = "https" | 		repositoryURL.Scheme = "https" | ||||||
| 		repositoryURL.Host = repositoryURL.Hostname() |  | ||||||
| 	} else { | 	} else { | ||||||
| 		secretOpts.PrivateKeyAlgorithm = sourcesecret.PrivateKeyAlgorithm(bootstrapArgs.keyAlgorithm) | 		secretOpts.PrivateKeyAlgorithm = sourcesecret.PrivateKeyAlgorithm(bootstrapArgs.keyAlgorithm) | ||||||
| 		secretOpts.Password = gitArgs.password | 		secretOpts.Password = gitArgs.password | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user