Skip to content

Commit

Permalink
Add default RucioUrl to be used by dasgoclient if it is not set via c…
Browse files Browse the repository at this point in the history
…onfig, read from map or RUCIO_URL env
  • Loading branch information
vkuznet committed Jan 21, 2022
1 parent a2bf102 commit 743545e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
4 changes: 4 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
5 changes: 4 additions & 1 deletion services/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
3 changes: 3 additions & 0 deletions services/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions web/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 743545e

Please sign in to comment.