lib/promscrape/discovery/openstack: use port 80 for the discovered target by default if it isnt specified in the config

This commit is contained in:
Aliaksandr Valialkin 2023-02-11 14:41:00 -08:00
parent 27b3209816
commit e6616c74a2
No known key found for this signature in database
GPG Key ID: A72BEC6CD3D0DED1

View File

@ -69,6 +69,10 @@ func getAPIConfig(sdc *SDConfig, baseDir string) (*apiConfig, error) {
}
func newAPIConfig(sdc *SDConfig, baseDir string) (*apiConfig, error) {
port := sdc.Port
if port == 0 {
port = 80
}
cfg := &apiConfig{
client: &http.Client{
Transport: &http.Transport{
@ -78,7 +82,7 @@ func newAPIConfig(sdc *SDConfig, baseDir string) (*apiConfig, error) {
availability: sdc.Availability,
region: sdc.Region,
allTenants: sdc.AllTenants,
port: sdc.Port,
port: port,
}
if sdc.TLSConfig != nil {
opts := &promauth.Options{