-
Notifications
You must be signed in to change notification settings - Fork 158
/
certs.go
38 lines (29 loc) · 605 Bytes
/
certs.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package empire
import (
"github.com/jinzhu/gorm"
"golang.org/x/net/context"
)
type certsService struct {
*Empire
}
func (s *certsService) CertsAttach(ctx context.Context, db *gorm.DB, opts CertsAttachOpts) error {
app := opts.App
if app.Certs == nil {
app.Certs = make(Certs)
}
process := opts.Process
if process == "" {
process = webProcessType
}
app.Certs[process] = opts.Cert
if err := appsUpdate(db, app); err != nil {
return err
}
if err := s.releases.ReleaseApp(ctx, db, app, nil); err != nil {
if err == ErrNoReleases {
return nil
}
return err
}
return nil
}