Skip to content

Commit

Permalink
version check fixed in stand-alone execution
Browse files Browse the repository at this point in the history
  • Loading branch information
ErykKul committed Mar 7, 2023
1 parent 83aa923 commit 2362879
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 9 additions & 2 deletions image/app/dataverse/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (

type dvVersion string

var version = getVersion()
var version dvVersion

var filesCleanup = "5.13"
var urlSigning = "https://github.com/IQSS/dataverse/pull/9383" // needs delete via native api and upload zip via native api to work
Expand All @@ -25,6 +25,13 @@ var slashInPermissions = "https://github.com/IQSS/dataverse/pull/8995" // will b
var nativeApiDelete = "https://github.com/IQSS/dataverse/pull/9383" // will be replaced with verion when pull request is merged

func init() {
if config.GetConfig().DataverseServer != "" {
Init()
}
}

func Init() {
version = getVersion()
if version.GreaterOrEqual(filesCleanup) {
logging.Logger.Printf("version %v >= %v: files cleanup feature is on", version, filesCleanup)
filesCleanup = "true"
Expand Down Expand Up @@ -64,7 +71,7 @@ func getVersion() dvVersion {
defer r.Body.Close()
b, _ := io.ReadAll(r.Body)
res := VersionResponse{}
if r.StatusCode != 200 || res.Status != "OK" {
if r.StatusCode != 200 {
logging.Logger.Println("error when getting version:", res.Message)
}
json.Unmarshal(b, &res)
Expand Down
2 changes: 2 additions & 0 deletions image/app/local/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"flag"
"fmt"
"integration/app/config"
"integration/app/dataverse"
"integration/app/destination"
"integration/app/frontend"
"integration/app/logging"
Expand Down Expand Up @@ -61,6 +62,7 @@ func main() {
MaxFileSize = *maxFileSize
mfs, _ := strconv.Atoi(MaxFileSize)
config.SetConfig(DataverseServer, RootDataverseId, DefaultHash, roles, true, int64(mfs))
dataverse.Init()
frontend.Config.DataverseHeader = DataverseServerName
frontend.Config.Plugins = append([]config.RepoPlugin{{
Id: "local",
Expand Down

0 comments on commit 2362879

Please sign in to comment.