| 1522 | } |
| 1523 | |
| 1524 | func replaceDetectionSub(envValues map[string]string, tenantDomain string, client *management.Client, port int) (map[string]string, error) { |
| 1525 | if port == 0 { |
| 1526 | port = 3000 |
| 1527 | } |
| 1528 | baseURL := fmt.Sprintf("http://localhost:%d", port) |
| 1529 | |
| 1530 | updatedEnvValues := make(map[string]string) |
| 1531 | |
| 1532 | for key, value := range envValues { |
| 1533 | if value != auth0.DetectionSub && value != auth0.DetectionSubAsBase { |
| 1534 | updatedEnvValues[key] = value |
| 1535 | continue |
| 1536 | } |
| 1537 | resolved, err := resolveDetectionSubValue(key, tenantDomain, baseURL, client) |
| 1538 | if err != nil { |
| 1539 | return nil, err |
| 1540 | } |
| 1541 | updatedEnvValues[key] = resolved |
| 1542 | } |
| 1543 | |
| 1544 | return updatedEnvValues, nil |
| 1545 | } |
| 1546 | |
| 1547 | // resolveDetectionSubValue maps a single env key to its runtime value. |
| 1548 | func resolveDetectionSubValue(key, tenantDomain, baseURL string, client *management.Client) (string, error) { |