Refactoring part 2.11: Long func refactoring in server and utils (#1083)

* Split long functions and optimize code

* Addressing comments

---------

Co-authored-by: Konstantin Koval
This commit is contained in:
Kostiantyn
2024-10-09 18:20:03 +03:00
committed by GitHub
parent 83e441650b
commit 69e595000d
5 changed files with 42 additions and 25 deletions

View File

@@ -56,7 +56,8 @@ func ApiEndpointUrl() *url.URL {
apiEndpointURL, err := url.Parse(apiEndpointStr)
if err != nil {
log.Fatalf("ERROR: Environment variable %s is not a proper url (%s)", EnvAPIEndpoint.GetName(), EnvAPIEndpoint.GetValue())
log.Fatalf("ERROR: Environment variable %s is not a proper url (%s)",
EnvAPIEndpoint.GetName(), EnvAPIEndpoint.GetValue())
}
if shouldServeUI {
@@ -74,7 +75,8 @@ func UiEndpointUrl() *url.URL {
uiEndpointURL, err := url.Parse(EnvUIEndpoint.GetValue())
if err != nil {
log.Fatalf("ERROR: Environment variable %s is not a proper url (%s)", EnvUIEndpoint.GetName(), EnvUIEndpoint.GetValue())
log.Fatalf("ERROR: Environment variable %s is not a proper url (%s)",
EnvUIEndpoint.GetName(), EnvUIEndpoint.GetValue())
}
return uiEndpointURL

View File

@@ -84,7 +84,8 @@ func IsDirSymlink(path string) (bool, error) {
resolvedFile, err := os.Stat(resolvedPath)
if err != nil {
return false, errors.Wrapf(err, "Cannot get fileinfo of linktarget %s of symlink %s, ignoring it", resolvedPath, path)
return false, fmt.Errorf("Cannot get fileinfo of linktarget %s of symlink %s, ignoring it: %w",
resolvedPath, path, err)
}
isDirSymlink = resolvedFile.IsDir()