Actually use gitea source
Signed-off-by: Lukas Bachschwell <lukas@lbsfilm.at>
This commit is contained in:
		
							
								
								
									
										13
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								main.go
									
									
									
									
									
								
							@@ -35,7 +35,16 @@ func main() {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func update(version string) error {
 | 
					func update(version string) error {
 | 
				
			||||||
	latest, found, err := selfupdate.DetectLatest("lbsadmin/goselfupdatetest")
 | 
						source, _ := selfupdate.NewGiteaSource(selfupdate.GiteaConfig{BaseURL: "https://git.lbsfilm.at/"})
 | 
				
			||||||
 | 
						updater, err := selfupdate.NewUpdater(selfupdate.Config{
 | 
				
			||||||
 | 
							Source:    source,
 | 
				
			||||||
 | 
							Validator: nil,
 | 
				
			||||||
 | 
							OS:        runtime.GOOS,
 | 
				
			||||||
 | 
							Arch:      runtime.GOARCH,
 | 
				
			||||||
 | 
							Arm:       0,
 | 
				
			||||||
 | 
						})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						latest, found, err := updater.DetectLatest("lbsadmin/goselfupdatetest")
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return fmt.Errorf("error occurred while detecting version: %v", err)
 | 
							return fmt.Errorf("error occurred while detecting version: %v", err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -52,7 +61,7 @@ func update(version string) error {
 | 
				
			|||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return errors.New("could not locate executable path")
 | 
							return errors.New("could not locate executable path")
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if err := selfupdate.UpdateTo(latest.AssetURL, latest.AssetName, exe); err != nil {
 | 
						if err := updater.UpdateTo(latest, exe); err != nil {
 | 
				
			||||||
		return fmt.Errorf("error occurred while updating binary: %v", err)
 | 
							return fmt.Errorf("error occurred while updating binary: %v", err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	log.Printf("Successfully updated to version %s", latest.Version())
 | 
						log.Printf("Successfully updated to version %s", latest.Version())
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user