From af8def71651289fbd5df8c5352fb69cef34b9bed Mon Sep 17 00:00:00 2001 From: Justin Hiemstra Date: Thu, 5 Oct 2023 17:13:47 +0000 Subject: [PATCH] Incorporate feedback from review --- cmd/origin_serve.go | 16 ++-- cmd/resources/xrootd.cfg | 6 +- cmd/root.go | 4 +- config/config.go | 28 ++++-- config/resources/defaults.yaml | 11 +-- docs/parameters.yaml | 154 ++++++++++++++++++++------------- go.mod | 2 +- metrics/xrootd_metrics.go | 4 +- namespace-registry/registry.go | 28 +++--- origin_ui/advertise.go | 1 + origin_ui/origin.go | 6 +- web_ui/prometheus.go | 4 +- web_ui/ui.go | 2 +- xrootd/authorization.go | 2 +- xrootd/authorization_test.go | 2 +- 15 files changed, 158 insertions(+), 112 deletions(-) diff --git a/cmd/origin_serve.go b/cmd/origin_serve.go index a07afe96c..da47176d9 100644 --- a/cmd/origin_serve.go +++ b/cmd/origin_serve.go @@ -64,8 +64,6 @@ type ( Port int ManagerHost string ManagerPort string - TLSCertFile string - TLSCertDir string MacaroonsKeyFile string RobotsTxtFile string Sitename string @@ -81,8 +79,10 @@ type ( } ServerConfig struct { - TLSCertificate string - TLSKey string + TLSCertificate string + TLSKey string + TLSCertificateDirectory string + TLSCertificateFile string } XrootdConfig struct { @@ -379,11 +379,11 @@ func checkDefaults() error { if originUrlParsed.Port() == "" { // No port was specified, let's tack on whatever was passed in the // command line argument - viper.Set("OriginUrl", originUrlParsed.String()+":"+fmt.Sprint(param.Server_WebPort.GetInt())) - } else if originUrlParsed.Port() != fmt.Sprint(param.Server_WebPort.GetInt()) { - // The web port configured via the config file and the webport configured + viper.Set("OriginUrl", originUrlParsed.String()+":"+fmt.Sprint(param.Server_Port.GetInt())) + } else if originUrlParsed.Port() != fmt.Sprint(param.Server_Port.GetInt()) { + // The web port configured via the config file and the port configured // via commandline don't match. Perhaps the user is confused? - return errors.New("Mismatched webports: from command line: " + fmt.Sprint(param.Server_WebPort.GetInt()) + + return errors.New("Mismatched ports: from command line: " + fmt.Sprint(param.Server_Port.GetInt()) + ", from config file: " + originUrlParsed.Port() + ". Please ensure these match") } diff --git a/cmd/resources/xrootd.cfg b/cmd/resources/xrootd.cfg index 9d0f3d300..cc00449e3 100644 --- a/cmd/resources/xrootd.cfg +++ b/cmd/resources/xrootd.cfg @@ -21,10 +21,10 @@ if exec xrootd xrd.protocol http:{{.Xrootd.Port}} libXrdHttp.so fi xrd.tls {{.Server.TLSCertificate}} {{.Server.TLSKey}} -{{if .Xrootd.TLSCertDir}} -xrd.tlsca certdir {{.Xrootd.TLSCertDir}} +{{if .Server.TLSCertificateDirectory}} +xrd.tlsca certdir {{.Server.TLSCertificateDirectory}} {{else}} -xrd.tlsca certfile {{.Xrootd.TLSCertFile}} +xrd.tlsca certfile {{.Server.TLSCertificateFile}} {{end}} http.exthandler xrdmacaroons libXrdMacaroons.so macaroons.secretkey {{.Xrootd.MacaroonsKeyFile}} diff --git a/cmd/root.go b/cmd/root.go index e9c18445b..bc3f00c0a 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -46,7 +46,7 @@ with data federations, enabling the sharing of objects and collections across multiple dataset providers.`, } - // We want the value of this port flag to correspond to the WebPort viper key. + // We want the value of this port flag to correspond to the Port viper key. // However, only one flag pointer can correspond to the key. If we define this // in `pelican registry serve` and `pelican director serve`, then whatever init() // function is run second will be the only one that is set (the first definition @@ -128,7 +128,7 @@ func initConfig() { if err := viper.BindPFlag("Debug", rootCmd.PersistentFlags().Lookup("debug")); err != nil { panic(err) } - if err := viper.BindPFlag("Server.WebPort", portFlag); err != nil { + if err := viper.BindPFlag("Server.Port", portFlag); err != nil { panic(err) } diff --git a/config/config.go b/config/config.go index 2cbee318a..a6e4b79bc 100644 --- a/config/config.go +++ b/config/config.go @@ -230,7 +230,7 @@ func ComputeExternalAddress() string { if config_url != "" { return config_url } - return fmt.Sprintf("%v:%v", param.Server_Hostname.GetString(), param.Server_WebPort.GetInt()) + return fmt.Sprintf("%v:%v", param.Server_Hostname.GetString(), param.Server_Port.GetInt()) } func getConfigBase() (string, error) { @@ -302,18 +302,18 @@ func InitServer() error { viper.SetDefault("Xrootd.MacaroonsKeyFile", filepath.Join(configDir, "macaroons-secret")) viper.SetDefault("IssuerKey", filepath.Join(configDir, "issuer.jwk")) viper.SetDefault("Origin.UIPasswordFile", filepath.Join(configDir, "origin-ui-passwd")) - viper.SetDefault("Registry.OIDCClientIDFile", filepath.Join(configDir, "oidc-client-id")) - viper.SetDefault("Registry.OIDCClientSecretFile", filepath.Join(configDir, "oidc-client-secret")) + viper.SetDefault("OIDC.ClientIDFile", filepath.Join(configDir, "oidc-client-id")) + viper.SetDefault("OIDC.ClientSecretFile", filepath.Join(configDir, "oidc-client-secret")) if IsRootExecution() { viper.SetDefault("Xrootd.RunLocation", "/run/pelican/xrootd") viper.SetDefault("Origin.Multiuser", true) viper.SetDefault("Director.GeoIPLocation", "/var/cache/pelican/maxmind/GeoLite2-City.mmdb") viper.SetDefault("Registry.DbLocation", "/var/lib/pelican/registry.sqlite") - viper.SetDefault("Prometheus.MonitoringData", "/var/lib/pelican/monitoring/data") + viper.SetDefault("Monitoring.DataLocation", "/var/lib/pelican/monitoring/data") } else { viper.SetDefault("Director.GeoIPLocation", filepath.Join(configDir, "maxmind", "GeoLite2-City.mmdb")) viper.SetDefault("Registry.DbLocation", filepath.Join(configDir, "ns-registry.sqlite")) - viper.SetDefault("Prometheus.MonitoringData", filepath.Join(configDir, "monitoring/data")) + viper.SetDefault("Monitoring.DataLocation", filepath.Join(configDir, "monitoring/data")) if userRuntimeDir := os.Getenv("XDG_RUNTIME_DIR"); userRuntimeDir != "" { runtimeDir := filepath.Join(userRuntimeDir, "pelican") @@ -332,9 +332,9 @@ func InitServer() error { } viper.SetDefault("Origin.Multiuser", false) } - viper.SetDefault("Xrootd.TLSCertFile", "/etc/pki/tls/cert.pem") + viper.SetDefault("Xrootd.TLSCertificateFile", "/etc/pki/tls/cert.pem") - err := os.MkdirAll(viper.GetString("Prometheus.MonitoringData"), 0750) + err := os.MkdirAll(viper.GetString("Monitoring.DataLocation"), 0750) if err != nil { return errors.Wrapf(err, "Failure when creating a directory for the monitoring data") } @@ -464,7 +464,19 @@ func InitClient() error { } break } - viper.Set("Client.MinimumDownloadSpeed", downloadLimit) + if viper.IsSet("MinimumDownloadSpeed") { + viper.SetDefault("Client.MinimumDownloadSpeed", viper.GetString("MinimumDownloadSpeed")) + } else { + viper.Set("Client.MinimumDownloadSpeed", downloadLimit) + } + + // Handle more legacy config options + if viper.IsSet("DisableProxyFallback") { + viper.SetDefault("Client.DisableProxyFallback", viper.GetString("DisableProxyFallback")) + } + if viper.IsSet("DisableHttpProxy") { + viper.SetDefault("Client.DisableHttpProxy", viper.GetString("DisableHttpProxy")) + } setupTransport() diff --git a/config/resources/defaults.yaml b/config/resources/defaults.yaml index 4efb3a8f8..0eb9eb900 100644 --- a/config/resources/defaults.yaml +++ b/config/resources/defaults.yaml @@ -15,17 +15,18 @@ # Debug: false -WebAddress: "0.0.0.0" + Server: - WebPort: 8444 + Port: 8444 + Address: "0.0.0.0" Director: DefaultResponse: cache Origin: NamespacePrefix: "" Multiuser: false -Prometheus: - MonitoringPortLower: 9930 - MonitoringPortHigher: 9999 +Monitoring: + PortLower: 9930 + ortHigher: 9999 Xrootd: Port: 8443 Mount: "" diff --git a/docs/parameters.yaml b/docs/parameters.yaml index 693a02099..8cde8a3fa 100644 --- a/docs/parameters.yaml +++ b/docs/parameters.yaml @@ -52,13 +52,6 @@ root_default: /etc/pelican/issuer.jwk default: $ConfigBase/issuer.jwk components: ["client", "nsregistry", "director"] --- -name: WebAddress -description: >- - A string-encoded IP address that the origin is configured to listen on. -type: string -default: 0.0.0.0 -components: ["origin"] ---- ############################ # Federation-Level Configs # @@ -127,6 +120,13 @@ type: bool default: false components: ["client"] --- +name: DisableHttpProxy +description: >- + A legacy configuration for disabling the client's HTTP proxy. See Client.DisableHttpProxy for new config. +type: bool +default: false +components: ["client"] +--- name: Client.DisableProxyFallback description: >- A bool indicating whether the a proxy fallback should be used by the client. @@ -134,6 +134,13 @@ type: bool default: false components: ["client"] --- +name: DisableProxyFallback +description: >- + A legacy configuration for disabling the client's proxy fallback. See Client.DisableProxyFallback for new config. +type: bool +default: false +components: ["client"] +--- name: Client.MinimumDownloadSpeed description: >- The minimum speed allowed for a client download before an error is thrown. @@ -141,6 +148,13 @@ type: int default: 102400 components: ["client"] --- +name: MinimumDownloadSpeed +description: >- + A legacy configuration for setting the client's minimum download speed. See Client.MinimumDownloadSpeed for new config. +type: int +default: 102400 +components: ["client"] +--- ############################ # Origin-level Configs # @@ -218,48 +232,6 @@ root_default: /var/lib/pelican/registry.sqlite default: $ConfigBase/ns-registry.sqlite components: ["nsregistry"] --- -name: Registry.OIDCClientIDFile -description: >- - A filepath to a file containing an OIDC Client ID. This is used by the namespace registry to establish OIDC information - for authenticated registration. -type: filename -root_default: /etc/pelican/oidc-client-id -default: $ConfigBase/oidc-client-id -components: ["nsregistry"] ---- -name: Registry.OIDCClientSecretFile -description: >- - A filepath to a file containing an OIDC Client Secret. This is used by the namespace registry to establish OIDC information - for authenticated registration. -type: filename -root_default: /etc/pelican/oidc-client-secret -default: $ConfigBase/oidc-client-secret -components: ["nsregistry"] ---- -name: Registry.OIDCDeviceAuthEndpoint -description: >- - A URL describing an OIDC Device Auth Endpoint. This is used by the namespace registry to establish OIDC information - for authenticated registration. -type: url -default: none -components: ["nsregistry"] ---- -name: Registry.OIDCTokenEndpoint -description: >- - A URL describing an OIDC Token Endpoint. This is used by the namespace registry to establish OIDC information - for authenticated registration. -type: url -default: none -components: ["nsregistry"] ---- -name: Registry.OIDCUserInfoEndpoint -description: >- - A URL describing an OIDC User Info Endpoint. This is used by the namespace registry to establish OIDC information - for authenticated registration. -type: url -default: none -components: ["nsregistry"] ---- ############################ # Server-level configs # @@ -273,6 +245,20 @@ root_default: /etc/pelican/certificates/tls.crt default: "$ConfigBase/certificates/tls.crt" components: ["origin", "nsregistry", "director"] --- +name: Server.TLSCertificateFile +description: >- + A filepath for a TLS certificate to be used by XRootD. +type: string +default: /etc/pki/tls/cert.pem +components: ["origin"] +--- +name: Server.TLSCertificateDirectory +description: >- + A filepath to the directory used for storing TLS certificates +type: string +default: /etc/pki/tls/cert.pem +components: ["origin"] +--- name: Server.TLSKey description: >- The name of a file containing a private key corresponding to the TLSCertificate. @@ -282,13 +268,20 @@ root_default: /etc/pelican/certificates/tls.key default: "$ConfigBase/certificates/tls.key" components: ["origin", "nsregistry", "director"] --- -name: Server.WebPort +name: Server.Port description: >- The port number the Pelican web interface will be bound to. type: int default: 8444 components: ["nsregistry", "director", "origin"] --- +name: Server.Address +description: >- + A string-encoded IP address that the origin is configured to listen on. +type: string +default: 0.0.0.0 +components: ["origin"] +--- name: Server.ExternalAddress description: >- A URL indicating the server's address as it appears externally. @@ -311,6 +304,52 @@ default: none components: ["origin", "director", "nsregistry"] --- + + + +name: OIDC.ClientIDFile +description: >- + A filepath to a file containing an OIDC Client ID. This is used by the namespace registry to establish OIDC information + for authenticated registration. +type: filename +root_default: /etc/pelican/oidc-client-id +default: $ConfigBase/oidc-client-id +components: ["nsregistry"] +--- +name: OIDC.ClientSecretFile +description: >- + A filepath to a file containing an OIDC Client Secret. This is used by the namespace registry to establish OIDC information + for authenticated registration. +type: filename +root_default: /etc/pelican/oidc-client-secret +default: $ConfigBase/oidc-client-secret +components: ["nsregistry"] +--- +name: OIDC.DeviceAuthEndpoint +description: >- + A URL describing an OIDC Device Auth Endpoint. This is used by the namespace registry to establish OIDC information + for authenticated registration. +type: url +default: none +components: ["nsregistry"] +--- +name: OIDC.TokenEndpoint +description: >- + A URL describing an OIDC Token Endpoint. This is used by the namespace registry to establish OIDC information + for authenticated registration. +type: url +default: none +components: ["nsregistry"] +--- +name: OIDC.UserInfoEndpoint +description: >- + A URL describing an OIDC User Info Endpoint. This is used by the namespace registry to establish OIDC information + for authenticated registration. +type: url +default: none +components: ["nsregistry"] +--- + ############################ # XRootD-level Configs # ############################ @@ -397,13 +436,6 @@ type: url default: none components: ["origin"] --- -name: Xrootd.TLSCertFile -description: >- - A filepath for a TLS certificate to be used by XRootD. -type: string -default: /etc/pki/tls/cert.pem -components: ["origin"] ---- name: Xrootd.Sitename description: >- The sitename, as configured for XRootD. @@ -413,9 +445,9 @@ components: ["origin"] --- ############################ -# Prometheus-level configs # +# Monitoring-level configs # ############################ -name: Prometheus.MonitoringData +name: Monitoring.DataLocation description: >- A filepath where Prometheus should host its monitoring data. type: string @@ -423,14 +455,14 @@ root_default: /var/lib/pelican/monitoring/data default: $ConfigBase/monitoring/data components: ["origin"] --- -name: Prometheus.MonitoringPortLower +name: Monitoring.PortLower description: >- The lower end of a range of monitoring ports for Prometheus configuration. type: int default: 9930 components: ["origin"] --- -name: Prometheus.MonitoringPortHigher +name: Monitoring.PortHigher description: >- The lower end of a range of monitoring ports for Prometheus configuration. type: int diff --git a/go.mod b/go.mod index eba01be5c..d5024f1a1 100644 --- a/go.mod +++ b/go.mod @@ -37,7 +37,6 @@ require ( golang.org/x/net v0.12.0 golang.org/x/oauth2 v0.10.0 golang.org/x/term v0.10.0 - gopkg.in/yaml.v2 v2.4.0 gopkg.in/yaml.v3 v3.0.1 kernel.org/pub/linux/libs/security/libcap/cap v1.2.69 modernc.org/sqlite v1.25.0 @@ -153,6 +152,7 @@ require ( google.golang.org/appengine v1.6.7 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect kernel.org/pub/linux/libs/security/libcap/psx v1.2.69 // indirect lukechampine.com/uint128 v1.2.0 // indirect modernc.org/cc/v3 v3.40.0 // indirect diff --git a/metrics/xrootd_metrics.go b/metrics/xrootd_metrics.go index 3bbe58ac7..701c07f23 100644 --- a/metrics/xrootd_metrics.go +++ b/metrics/xrootd_metrics.go @@ -154,8 +154,8 @@ var ( ) func ConfigureMonitoring() (int, error) { - lower := param.Prometheus_MonitoringPortLower.GetInt() - higher := param.Prometheus_MonitoringPortHigher.GetInt() + lower := param.Monitoring_PortLower.GetInt() + higher := param.Monitoring_PortHigher.GetInt() addr := net.UDPAddr{IP: net.ParseIP("127.0.0.1")} var conn *net.UDPConn diff --git a/namespace-registry/registry.go b/namespace-registry/registry.go index 9098621d8..b33b35d6d 100644 --- a/namespace-registry/registry.go +++ b/namespace-registry/registry.go @@ -137,23 +137,23 @@ func loadServerKeys() (*ecdsa.PrivateKey, error) { func loadOIDC() error { // Load OIDC.ClientID - OIDCClientIDFile := param.Registry_OIDCClientIDFile.GetString() + OIDCClientIDFile := param.OIDC_ClientIDFile.GetString() OIDCClientIDFromEnv := viper.GetString("OIDCCLIENTID") if OIDCClientIDFile != "" { contents, err := os.ReadFile(OIDCClientIDFile) if err != nil { - return errors.Wrapf(err, "Failed reading provided Registry.OIDCClientIDFile %s", OIDCClientIDFile) + return errors.Wrapf(err, "Failed reading provided OIDC.ClientIDFile %s", OIDCClientIDFile) } OIDC.ClientID = strings.TrimSpace(string(contents)) } else if OIDCClientIDFromEnv != "" { OIDC.ClientID = OIDCClientIDFromEnv } else { - return errors.New("An OIDC Client Identity file must be specified in the config (Registry.OIDCClientIDFile)," + + return errors.New("An OIDC Client Identity file must be specified in the config (OIDC.ClientIDFile)," + " or the identity must be provided via the environment variable PELICAN_OIDCCLIENTID") } // load OIDC.ClientSecret - OIDCClientSecretFile := param.Registry_OIDCClientSecretFile.GetString() + OIDCClientSecretFile := param.OIDC_ClientSecretFile.GetString() OIDCClientSecretFromEnv := viper.GetString("OIDCCLIENTSECRET") if OIDCClientSecretFile != "" { contents, err := os.ReadFile(OIDCClientSecretFile) @@ -164,40 +164,40 @@ func loadOIDC() error { } else if OIDCClientSecretFromEnv != "" { OIDC.ClientSecret = OIDCClientSecretFromEnv } else { - return errors.New("An OIDC Client Secret file must be specified in the config (Registry.OIDCClientSecretFile)," + + return errors.New("An OIDC Client Secret file must be specified in the config (OIDC.ClientSecretFile)," + " or the secret must be provided via the environment variable PELICAN_OIDCCLIENTSECRET") } // Load OIDC.DeviceAuthEndpoint - deviceAuthEndpoint := param.Registry_OIDCDeviceAuthEndpoint.GetString() + deviceAuthEndpoint := param.OIDC_DeviceAuthEndpoint.GetString() if deviceAuthEndpoint == "" { - return errors.New("Nothing set for config parameter Registry.OIDCDeviceAuthEndpoint, so registration with identity not supported") + return errors.New("Nothing set for config parameter OIDC.DeviceAuthEndpoint, so registration with identity not supported") } deviceAuthEndpointURL, err := url.Parse(deviceAuthEndpoint) if err != nil { - return errors.New("Failed to parse URL for parameter Registry.OIDCDeviceAuthEndpoint") + return errors.New("Failed to parse URL for parameter OIDC.DeviceAuthEndpoint") } OIDC.DeviceAuthEndpoint = deviceAuthEndpointURL.String() // Load OIDC.TokenEndpoint - tokenEndpoint := param.Registry_OIDCTokenEndpoint.GetString() + tokenEndpoint := param.OIDC_TokenEndpoint.GetString() if tokenEndpoint == "" { - return errors.New("Nothing set for config parameter Registry.OIDCTokenEndpoint, so registration with identity not supported") + return errors.New("Nothing set for config parameter OIDC.TokenEndpoint, so registration with identity not supported") } tokenAuthEndpointURL, err := url.Parse(tokenEndpoint) if err != nil { - return errors.New("Failed to parse URL for parameter Registry.OIDCTokenEndpoint") + return errors.New("Failed to parse URL for parameter OIDC.TokenEndpoint") } OIDC.TokenEndpoint = tokenAuthEndpointURL.String() // Load OIDC.UserInfoEndpoint - userInfoEndpoint := param.Registry_OIDCTokenEndpoint.GetString() + userInfoEndpoint := param.OIDC_TokenEndpoint.GetString() if userInfoEndpoint == "" { - return errors.New("Nothing set for config parameter Registry.OIDCUserInfoEndpoint, so registration with identity not supported") + return errors.New("Nothing set for config parameter OIDC.UserInfoEndpoint, so registration with identity not supported") } userInfoEndpointURL, err := url.Parse(userInfoEndpoint) if err != nil { - return errors.New("Failed to parse URL for parameter Registry.OIDCUserInfoEndpoint") + return errors.New("Failed to parse URL for parameter OIDC.UserInfoEndpoint") } OIDC.UserInfoEndpoint = userInfoEndpointURL.String() diff --git a/origin_ui/advertise.go b/origin_ui/advertise.go index 10c334232..f6994a1e1 100644 --- a/origin_ui/advertise.go +++ b/origin_ui/advertise.go @@ -26,6 +26,7 @@ import ( "net/url" "time" + "github.com/pelicanplatform/pelican/client" "github.com/pelicanplatform/pelican/config" "github.com/pelicanplatform/pelican/director" "github.com/pelicanplatform/pelican/param" diff --git a/origin_ui/origin.go b/origin_ui/origin.go index d0b67ede1..4b997047b 100644 --- a/origin_ui/origin.go +++ b/origin_ui/origin.go @@ -103,7 +103,7 @@ func WaitUntilLogin() error { signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM) hostname := param.Server_Hostname.GetString() - webPort := param.Server_WebPort.GetInt() + port := param.Server_Port.GetInt() isTTY := false if term.IsTerminal(int(os.Stdout.Fd())) { isTTY = true @@ -119,10 +119,10 @@ func WaitUntilLogin() error { fmt.Printf("\033[2K\n") fmt.Printf("\033[2K\rPelican admin interface is not initialized\n\033[2KTo initialize, "+ "login at \033[1;34mhttps://%v:%v/view/initialization/code/\033[0m with the following code:\n", - hostname, webPort) + hostname, port) fmt.Printf("\033[2K\r\033[1;34m%v\033[0m\n", *currentCode.Load()) } else { - fmt.Printf("Pelican admin interface is not initialized\n To initialize, login at https://%v:%v/view/initialization/code/ with the following code:\n", hostname, webPort) + fmt.Printf("Pelican admin interface is not initialized\n To initialize, login at https://%v:%v/view/initialization/code/ with the following code:\n", hostname, port) fmt.Println(*currentCode.Load()) } start := time.Now() diff --git a/web_ui/prometheus.go b/web_ui/prometheus.go index d28ac210f..9d27f2099 100644 --- a/web_ui/prometheus.go +++ b/web_ui/prometheus.go @@ -140,9 +140,9 @@ func runtimeInfo() (api_v1.RuntimeInfo, error) { func ConfigureEmbeddedPrometheus(engine *gin.Engine) error { cfg := flagConfig{} - ListenAddress := fmt.Sprintf("0.0.0.0:%v", param.Server_WebPort.GetInt()) + ListenAddress := fmt.Sprintf("0.0.0.0:%v", param.Server_Port.GetInt()) cfg.webTimeout = model.Duration(5 * time.Minute) - cfg.serverStoragePath = param.Prometheus_MonitoringData.GetString() + cfg.serverStoragePath = param.Monitoring_DataLocation.GetString() cfg.tsdb.MinBlockDuration = model.Duration(2 * time.Hour) cfg.tsdb.NoLockfile = false cfg.tsdb.WALCompression = true diff --git a/web_ui/ui.go b/web_ui/ui.go index 030383cf4..d2eef6113 100644 --- a/web_ui/ui.go +++ b/web_ui/ui.go @@ -74,7 +74,7 @@ func RunEngine(engine *gin.Engine) { certFile := param.Server_TLSCertificate.GetString() keyFile := param.Server_TLSKey.GetString() - addr := fmt.Sprintf("%v:%v", param.WebAddress.GetString(), param.Server_WebPort.GetInt()) + addr := fmt.Sprintf("%v:%v", param.Server_Address.GetString(), param.Server_Port.GetInt()) log.Debugln("Starting web engine at address", addr) err := engine.RunTLS(addr, certFile, keyFile) diff --git a/xrootd/authorization.go b/xrootd/authorization.go index 3e6908c0e..14f6d4403 100644 --- a/xrootd/authorization.go +++ b/xrootd/authorization.go @@ -184,7 +184,7 @@ func GenerateMonitoringIssuer() (issuer Issuer, err error) { return } issuer.Name = "Built-in Monitoring" - issuer.Issuer = "https://" + param.Server_Hostname.GetString() + ":" + fmt.Sprint(param.Server_WebPort.GetInt()) + issuer.Issuer = "https://" + param.Server_Hostname.GetString() + ":" + fmt.Sprint(param.Server_Port.GetInt()) issuer.BasePaths = []string{"/pelican/monitoring"} issuer.DefaultUser = "xrootd" diff --git a/xrootd/authorization_test.go b/xrootd/authorization_test.go index 7d83376b8..d85e80801 100644 --- a/xrootd/authorization_test.go +++ b/xrootd/authorization_test.go @@ -123,7 +123,7 @@ func TestGenerateConfig(t *testing.T) { issuer, err = GenerateMonitoringIssuer() require.NoError(t, err) assert.Equal(t, issuer.Name, "Built-in Monitoring") - assert.Equal(t, issuer.Issuer, "https://"+param.Server_Hostname.GetString()+":"+fmt.Sprint(param.Server_WebPort.GetInt())) + assert.Equal(t, issuer.Issuer, "https://"+param.Server_Hostname.GetString()+":"+fmt.Sprint(param.Server_Port.GetInt())) require.Equal(t, len(issuer.BasePaths), 1) assert.Equal(t, issuer.BasePaths[0], "/pelican/monitoring") assert.Equal(t, issuer.DefaultUser, "xrootd")