diff --git a/dest/config/file_mapper.go b/dest/config/file_mapper.go index e413552..2aef8e5 100644 --- a/dest/config/file_mapper.go +++ b/dest/config/file_mapper.go @@ -11,6 +11,10 @@ type File struct { CAFileMode string CAFileGid string CAFileUid string + CABundleFile string + CABundleFileMode string + CABundleFileGid string + CABundleFileUid string CertFile string CertFileMode string CertFileGid string @@ -40,6 +44,15 @@ func FileMapper(v interface{}) (dest.Dest, error) { } fileDests = append(fileDests, dest.NewTemplateFile(dest.CAFile, caFile)) } + if conf.CABundleFile != "" { + caBundleFile, err := DestFileBuilder(conf.CABundleFile, + conf.CABundleFileMode, conf.CABundleFileGid, conf.CABundleFileUid) + if err != nil { + return nil, errors.Wrap(err, "caBundleFile") + } + fileDests = append(fileDests, dest.NewTemplateFile(dest.CABundleFile, + caBundleFile)) + } if conf.CertFile != "" { certFile, err := DestFileBuilder(conf.CertFile, conf.CertFileMode, conf.CertFileGid, conf.CertFileUid) diff --git a/dest/file_dest.go b/dest/file_dest.go index 477a22c..01cf85f 100644 --- a/dest/file_dest.go +++ b/dest/file_dest.go @@ -3,6 +3,7 @@ package dest type FileDestType string var ( + CABundleFile FileDestType = "{{ .CABundle }}" CAFile FileDestType = "{{ .CA }}" CertificateFile FileDestType = "{{ .Certificate }}" CertificateBundleFile FileDestType = "{{ .Certificate }}\n{{ .CABundle }}"