Skip to content

Commit fa039ff

Browse files
authored
Merge pull request #472 from DopplerHQ/andre/inheritance-2
chore: Rename ProjectSlug/ConfigName to Project/Config in descriptor model
2 parents d67deaf + 3fbeb97 commit fa039ff

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

pkg/http/api.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1093,9 +1093,9 @@ func UpdateConfigInherits(host string, verifyTLS bool, apiKey string, project st
10931093
for _, cd := range configDescriptors {
10941094
parts := strings.Split(cd, ".")
10951095
if len(parts) != 2 {
1096-
return models.ConfigInfo{}, Error{Message: "Config descriptors must match the format \"projectSlug.configName\""}
1096+
return models.ConfigInfo{}, Error{Message: "Config descriptors must match the format \"project.config\""}
10971097
}
1098-
inheritsObj = append(inheritsObj, models.ConfigDescriptor{ProjectSlug: parts[0], ConfigName: parts[1]})
1098+
inheritsObj = append(inheritsObj, models.ConfigDescriptor{Project: parts[0], Config: parts[1]})
10991099
}
11001100
}
11011101

pkg/models/api.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,6 @@ type WatchSecrets struct {
180180
}
181181

182182
type ConfigDescriptor struct {
183-
ProjectSlug string `json:"projectSlug"`
184-
ConfigName string `json:"configName"`
183+
Project string `json:"project"`
184+
Config string `json:"config"`
185185
}

pkg/models/parse.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,15 +119,15 @@ func ParseConfigInfo(info map[string]interface{}) ConfigInfo {
119119
inherits := info["inherits"].([]interface{})
120120
for _, i := range inherits {
121121
descriptorMap := i.(map[string]interface{})
122-
configInfo.Inherits = append(configInfo.Inherits, ConfigDescriptor{ProjectSlug: descriptorMap["projectSlug"].(string), ConfigName: descriptorMap["configName"].(string)})
122+
configInfo.Inherits = append(configInfo.Inherits, ConfigDescriptor{Project: descriptorMap["project"].(string), Config: descriptorMap["config"].(string)})
123123
}
124124
}
125125
if info["inheritedBy"] != nil {
126126
configInfo.InheritedBy = []ConfigDescriptor{}
127127
inheritedBy := info["inheritedBy"].([]interface{})
128128
for _, i := range inheritedBy {
129129
descriptorMap := i.(map[string]interface{})
130-
configInfo.InheritedBy = append(configInfo.InheritedBy, ConfigDescriptor{ProjectSlug: descriptorMap["projectSlug"].(string), ConfigName: descriptorMap["configName"].(string)})
130+
configInfo.InheritedBy = append(configInfo.InheritedBy, ConfigDescriptor{Project: descriptorMap["project"].(string), Config: descriptorMap["config"].(string)})
131131
}
132132
}
133133

pkg/printer/enclave.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,12 @@ func ConfigInfo(info models.ConfigInfo, jsonFlag bool) {
137137
if info.Inheritable {
138138
inheritsHeader = "inherited by"
139139
for _, inheritedBy := range info.InheritedBy {
140-
inheritsStrings = append(inheritsStrings, fmt.Sprintf("%s.%s", inheritedBy.ProjectSlug, inheritedBy.ConfigName))
140+
inheritsStrings = append(inheritsStrings, fmt.Sprintf("%s.%s", inheritedBy.Project, inheritedBy.Config))
141141
}
142142
} else {
143143
inheritsHeader = "inherits"
144144
for _, inherits := range info.Inherits {
145-
inheritsStrings = append(inheritsStrings, fmt.Sprintf("%s.%s", inherits.ProjectSlug, inherits.ConfigName))
145+
inheritsStrings = append(inheritsStrings, fmt.Sprintf("%s.%s", inherits.Project, inherits.Config))
146146
}
147147
}
148148

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

184184
var inheritsString string

0 commit comments

Comments
 (0)