Fix Update

This commit is contained in:
2026-07-11 02:07:00 -03:00
parent aea27916e8
commit cc72b92932
+3 -3
View File
@@ -86,13 +86,13 @@ func getUpdateStatus(parent context.Context, force bool) updateStatusResponse {
} }
func checkRemoteUpdate(parent context.Context) updateStatusResponse { func checkRemoteUpdate(parent context.Context) updateStatusResponse {
repoURL := firstNonEmpty( repoURL := firstNonEmptyTrimmed(
strings.TrimSpace(os.Getenv("DRAGON_UPDATE_REPO_URL")), strings.TrimSpace(os.Getenv("DRAGON_UPDATE_REPO_URL")),
readSingleLineFile("/opt/sshpanel/.installed_repo_url"), readSingleLineFile("/opt/sshpanel/.installed_repo_url"),
strings.TrimSpace(buildRepoURL), strings.TrimSpace(buildRepoURL),
defaultUpdateRepoURL, defaultUpdateRepoURL,
) )
branch := firstNonEmpty( branch := firstNonEmptyTrimmed(
strings.TrimSpace(os.Getenv("DRAGON_UPDATE_BRANCH")), strings.TrimSpace(os.Getenv("DRAGON_UPDATE_BRANCH")),
strings.TrimSpace(buildBranch), strings.TrimSpace(buildBranch),
readSingleLineFile("/opt/sshpanel/.installed_branch"), readSingleLineFile("/opt/sshpanel/.installed_branch"),
@@ -235,7 +235,7 @@ func readSingleLineFile(path string) string {
return line return line
} }
func firstNonEmpty(values ...string) string { func firstNonEmptyTrimmed(values ...string) string {
for _, value := range values { for _, value := range values {
if strings.TrimSpace(value) != "" { if strings.TrimSpace(value) != "" {
return strings.TrimSpace(value) return strings.TrimSpace(value)