parseUpdateProjectConfig handles update-project configuration
(outputMap map[string]any)
| 34 | |
| 35 | // parseUpdateProjectConfig handles update-project configuration |
| 36 | func (c *Compiler) parseUpdateProjectConfig(outputMap map[string]any) *UpdateProjectConfig { |
| 37 | if configData, exists := outputMap["update-project"]; exists { |
| 38 | updateProjectLog.Print("Parsing update-project configuration") |
| 39 | updateProjectConfig := &UpdateProjectConfig{} |
| 40 | updateProjectConfig.Max = defaultIntStr(10) // Default max is 10 |
| 41 | |
| 42 | if configMap, ok := configData.(map[string]any); ok { |
| 43 | // Parse base config (max, github-token) |
| 44 | c.parseBaseSafeOutputConfig(configMap, &updateProjectConfig.BaseSafeOutputConfig, 10) |
| 45 | |
| 46 | // Parse github-token override if specified |
| 47 | if token, exists := configMap["github-token"]; exists { |
| 48 | if tokenStr, ok := token.(string); ok { |
| 49 | updateProjectConfig.GitHubToken = tokenStr |
| 50 | updateProjectLog.Print("Using custom GitHub token for update-project") |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | // Parse project URL override if specified |
| 55 | if project, exists := configMap["project"]; exists { |
| 56 | if projectStr, ok := project.(string); ok { |
| 57 | updateProjectConfig.Project = projectStr |
| 58 | updateProjectLog.Printf("Using custom project URL for update-project: %s", projectStr) |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | // Parse target-repo for cross-repo content resolution (no wildcard allowed) |
| 63 | targetRepoSlug, isInvalid := parseTargetRepoWithValidation(configMap) |
| 64 | if isInvalid { |
| 65 | return nil |
| 66 | } |
| 67 | updateProjectConfig.TargetRepoSlug = targetRepoSlug |
| 68 | |
| 69 | // Parse allowed-repos for cross-repo content resolution |
| 70 | updateProjectConfig.AllowedRepos = ParseStringArrayFromConfig(configMap, "allowed-repos", updateProjectLog) |
| 71 | |
| 72 | // Parse views if specified |
| 73 | updateProjectConfig.Views = parseProjectViews(configMap, updateProjectLog) |
| 74 | |
| 75 | // Parse field-definitions if specified |
| 76 | updateProjectConfig.FieldDefinitions = parseProjectFieldDefinitions(configMap, updateProjectLog) |
| 77 | } |
| 78 | |
| 79 | updateProjectLog.Printf("Parsed update-project config: max=%d, hasCustomToken=%v, hasCustomProject=%v, targetRepo=%q, allowedReposCount=%d, viewCount=%d, fieldDefinitionCount=%d", |
| 80 | updateProjectConfig.Max, updateProjectConfig.GitHubToken != "", updateProjectConfig.Project != "", updateProjectConfig.TargetRepoSlug, len(updateProjectConfig.AllowedRepos), len(updateProjectConfig.Views), len(updateProjectConfig.FieldDefinitions)) |
| 81 | return updateProjectConfig |
| 82 | } |
| 83 | updateProjectLog.Print("No update-project configuration found") |
| 84 | return nil |
| 85 | } |