1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-08-09 15:55:23 +02:00

fix ssl settings issue

This commit is contained in:
Prabhat Khera 2023-05-12 17:20:51 +12:00
parent 357cb66fbf
commit 4205d871de
2 changed files with 9 additions and 15 deletions

View file

@ -4,21 +4,11 @@ import (
portainer "github.com/portainer/portainer/api"
)
const (
// BucketName represents the name of the bucket where this service stores data.
BucketName = "ssl"
key = "SSL"
)
// Service represents a service for managing ssl data.
type Service struct {
connection portainer.Connection
}
func (service *Service) BucketName() string {
return BucketName
}
// NewService creates a new instance of a service.
func NewService(connection portainer.Connection) (*Service, error) {
return &Service{
@ -41,7 +31,8 @@ func (service *Service) Settings() (*portainer.SSLSettings, error) {
// UpdateSettings persists a SSLSettings object.
func (service *Service) UpdateSettings(settings *portainer.SSLSettings) error {
db := service.connection.GetDB()
tx := db.Model(&portainer.SSLSettings{}).Where(portainer.SSLSettings{}).FirstOrCreate(settings)
settings.ID = 1
tx := db.Save(settings)
if tx.Error != nil {
return tx.Error
}

View file

@ -984,12 +984,15 @@ type (
// SoftwareEdition represents an edition of Portainer
SoftwareEdition int
SSHSettingsID int
// SSLSettings represents a pair of SSL certificate and key
SSLSettings struct {
CertPath string `json:"certPath"`
KeyPath string `json:"keyPath"`
SelfSigned bool `json:"selfSigned"`
HTTPEnabled bool `json:"httpEnabled"`
ID SSHSettingsID `json:"Id" gorm:"unique,primaryKey,autoIncrement"`
CertPath string `json:"certPath"`
KeyPath string `json:"keyPath"`
SelfSigned bool `json:"selfSigned"`
HTTPEnabled bool `json:"httpEnabled"`
}
// Stack represents a Docker stack created via docker stack deploy