diff --git a/config/config.go b/config/config.go index b7d7be7..c25aeaf 100644 --- a/config/config.go +++ b/config/config.go @@ -36,6 +36,7 @@ type Configuration struct { UpdateDNs int `json:"updateDNs"` // interval in minutes to update user DNs Timeout int `json:"timeout"` // query time out Frontend string `json:"frontend"` // frontend URI to use + RucioUrl string `json:"rucioUrl"` // default RucioUrl RucioTokenCurl bool `json:"rucioTokenCurl"` // use curl method to obtain Rucio Token ProfileFile string `json:"profileFile"` // send profile data to a given file TLSCertsRenewInterval int `json:"tlsCertsRenewInterval"` // renewal interval for TLS certs @@ -71,5 +72,8 @@ func ParseConfig(configFile string) error { if Config.TLSCertsRenewInterval == 0 { Config.TLSCertsRenewInterval = 600 } + if Config.RucioUrl == "" { + Config.RucioUrl = "https://cms-rucio.cern.ch" + } return nil } diff --git a/services/helpers.go b/services/helpers.go index c0cc06e..64d5c95 100644 --- a/services/helpers.go +++ b/services/helpers.go @@ -123,7 +123,10 @@ func RucioUrl() string { if strings.HasPrefix(url, "http") { return url } - return utils.AdjustUrl(fmt.Sprintf("%s/%s", FrontendURL, url)) + // here we hard-code rucio url since it should be used by dasgoclient + // for das web it will be fetched from dasmaps DB, otherwise + // it should be either set via RUCIO_URL or we should have valid default + return utils.AdjustUrl(fmt.Sprintf("%s/%s", RucioURL, url)) } func bareRucioUrl() string { v := utils.GetEnv("RUCIO_URL") diff --git a/services/services.go b/services/services.go index 7d3f58a..af6f3ee 100644 --- a/services/services.go +++ b/services/services.go @@ -20,6 +20,9 @@ import ( // FrontendURL represents DAS frontend URL var FrontendURL string +// RucioURL represents Rucio URL +var RucioURL string + // remap function uses DAS notations and convert series of DAS records // into another set where appropriate remapping is done func remap(api string, records []mongo.DASRecord, notations []mongo.DASRecord) []mongo.DASRecord { diff --git a/web/server.go b/web/server.go index 360e9f6..96b5fbe 100644 --- a/web/server.go +++ b/web/server.go @@ -137,6 +137,7 @@ func Server(configFile string) { utils.DASMAPS = config.Config.DasMaps utils.TIMEOUT = config.Config.Timeout services.FrontendURL = config.Config.Frontend + services.RucioURL = config.Config.RucioUrl interval := time.Duration(config.Config.TLSCertsRenewInterval) utils.TLSCertsRenewInterval = time.Duration(interval * time.Second) utils.RucioTokenCurl = config.Config.RucioTokenCurl