Skip to content

Commit 86958fc

Browse files
authored
Merge pull request #108 from onepanelio/feat/validate.fqdn.domain
feat: make sure fqdn ends in domain
2 parents 0bafa96 + 1812d77 commit 86958fc

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

manifest/manifest.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,26 @@ func Validate(manifest *util.DynamicYaml) error {
183183
}
184184
}
185185

186+
domain := manifest.GetValue("application.domain")
187+
if domain == nil {
188+
return &ParamsError{Key: "application.domain", ShortKey: "domain", ErrorType: "missing"}
189+
}
190+
if domain.Value == "" {
191+
return &ParamsError{Key: "application.domain", ShortKey: "domain", ErrorType: "blank"}
192+
}
193+
194+
fqdn := manifest.GetValue("application.fqdn")
195+
if fqdn == nil {
196+
return &ParamsError{Key: "application.fqdn", ShortKey: "fqdn", ErrorType: "missing"}
197+
}
198+
if fqdn.Value == "" {
199+
return &ParamsError{Key: "application.fqdn", ShortKey: "fqdn", ErrorType: "blank"}
200+
}
201+
202+
if !strings.HasSuffix(fqdn.Value, domain.Value) {
203+
return fmt.Errorf("application.fqdn does not end in application.domain")
204+
}
205+
186206
flatMap := manifest.FlattenToKeyValue(util.AppendDotFlatMapKeyFormatter)
187207
mapKeys := []string{}
188208
for key := range flatMap {

0 commit comments

Comments
 (0)