| 1 |
// Copyright The OpenTelemetry Authors |
| 2 |
// SPDX-License-Identifier: Apache-2.0 |
| 3 |
|
| 4 |
package migration // import "go.opentelemetry.io/collector/service/telemetry/internal/migration" |
| 5 |
|
| 6 |
import "strings" |
| 7 |
|
| 8 |
func normalizeEndpoint(endpoint string, insecure *bool) *string { |
| 9 |
if !strings.HasPrefix(endpoint, "https://") && !strings.HasPrefix(endpoint, "http://") { |
| 10 |
if insecure != nil && *insecure { |
| 11 |
endpoint = "http://" + endpoint |
| 12 |
} else { |
| 13 |
endpoint = "https://" + endpoint |
| 14 |
} |
| 15 |
} |
| 16 |
return &endpoint |
| 17 |
} |