Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Rename ProjectSlug/ConfigName to Project/Config in descriptor model #472

Merged
merged 1 commit into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pkg/http/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -1093,9 +1093,9 @@ func UpdateConfigInherits(host string, verifyTLS bool, apiKey string, project st
for _, cd := range configDescriptors {
parts := strings.Split(cd, ".")
if len(parts) != 2 {
return models.ConfigInfo{}, Error{Message: "Config descriptors must match the format \"projectSlug.configName\""}
return models.ConfigInfo{}, Error{Message: "Config descriptors must match the format \"project.config\""}
}
inheritsObj = append(inheritsObj, models.ConfigDescriptor{ProjectSlug: parts[0], ConfigName: parts[1]})
inheritsObj = append(inheritsObj, models.ConfigDescriptor{Project: parts[0], Config: parts[1]})
}
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/models/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,6 @@ type WatchSecrets struct {
}

type ConfigDescriptor struct {
ProjectSlug string `json:"projectSlug"`
ConfigName string `json:"configName"`
Project string `json:"project"`
Config string `json:"config"`
}
4 changes: 2 additions & 2 deletions pkg/models/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,15 @@ func ParseConfigInfo(info map[string]interface{}) ConfigInfo {
inherits := info["inherits"].([]interface{})
for _, i := range inherits {
descriptorMap := i.(map[string]interface{})
configInfo.Inherits = append(configInfo.Inherits, ConfigDescriptor{ProjectSlug: descriptorMap["projectSlug"].(string), ConfigName: descriptorMap["configName"].(string)})
configInfo.Inherits = append(configInfo.Inherits, ConfigDescriptor{Project: descriptorMap["project"].(string), Config: descriptorMap["config"].(string)})
}
}
if info["inheritedBy"] != nil {
configInfo.InheritedBy = []ConfigDescriptor{}
inheritedBy := info["inheritedBy"].([]interface{})
for _, i := range inheritedBy {
descriptorMap := i.(map[string]interface{})
configInfo.InheritedBy = append(configInfo.InheritedBy, ConfigDescriptor{ProjectSlug: descriptorMap["projectSlug"].(string), ConfigName: descriptorMap["configName"].(string)})
configInfo.InheritedBy = append(configInfo.InheritedBy, ConfigDescriptor{Project: descriptorMap["project"].(string), Config: descriptorMap["config"].(string)})
}
}

Expand Down
6 changes: 3 additions & 3 deletions pkg/printer/enclave.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,12 @@ func ConfigInfo(info models.ConfigInfo, jsonFlag bool) {
if info.Inheritable {
inheritsHeader = "inherited by"
for _, inheritedBy := range info.InheritedBy {
inheritsStrings = append(inheritsStrings, fmt.Sprintf("%s.%s", inheritedBy.ProjectSlug, inheritedBy.ConfigName))
inheritsStrings = append(inheritsStrings, fmt.Sprintf("%s.%s", inheritedBy.Project, inheritedBy.Config))
}
} else {
inheritsHeader = "inherits"
for _, inherits := range info.Inherits {
inheritsStrings = append(inheritsStrings, fmt.Sprintf("%s.%s", inherits.ProjectSlug, inherits.ConfigName))
inheritsStrings = append(inheritsStrings, fmt.Sprintf("%s.%s", inherits.Project, inherits.Config))
}
}

Expand Down Expand Up @@ -178,7 +178,7 @@ func ConfigsInfo(info []models.ConfigInfo, jsonFlag bool) {
for _, configInfo := range info {
var inheritsStrings []string
for _, inherits := range configInfo.Inherits {
inheritsStrings = append(inheritsStrings, fmt.Sprintf("%s.%s", inherits.ProjectSlug, inherits.ConfigName))
inheritsStrings = append(inheritsStrings, fmt.Sprintf("%s.%s", inherits.Project, inherits.Config))
}

var inheritsString string
Expand Down
Loading