mirror of https://github.com/portainer/portainer
refactor(api): rename file package to filesystem (#1555)
parent
03f6cc0acf
commit
d2f3309842
|
@ -7,7 +7,7 @@ import (
|
||||||
"github.com/portainer/portainer/cron"
|
"github.com/portainer/portainer/cron"
|
||||||
"github.com/portainer/portainer/crypto"
|
"github.com/portainer/portainer/crypto"
|
||||||
"github.com/portainer/portainer/exec"
|
"github.com/portainer/portainer/exec"
|
||||||
"github.com/portainer/portainer/file"
|
"github.com/portainer/portainer/filesystem"
|
||||||
"github.com/portainer/portainer/git"
|
"github.com/portainer/portainer/git"
|
||||||
"github.com/portainer/portainer/http"
|
"github.com/portainer/portainer/http"
|
||||||
"github.com/portainer/portainer/jwt"
|
"github.com/portainer/portainer/jwt"
|
||||||
|
@ -31,7 +31,7 @@ func initCLI() *portainer.CLIFlags {
|
||||||
}
|
}
|
||||||
|
|
||||||
func initFileService(dataStorePath string) portainer.FileService {
|
func initFileService(dataStorePath string) portainer.FileService {
|
||||||
fileService, err := file.NewService(dataStorePath, "")
|
fileService, err := filesystem.NewService(dataStorePath, "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package file
|
package filesystem
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
|
@ -5,7 +5,7 @@ import (
|
||||||
|
|
||||||
"github.com/asaskevich/govalidator"
|
"github.com/asaskevich/govalidator"
|
||||||
"github.com/portainer/portainer"
|
"github.com/portainer/portainer"
|
||||||
"github.com/portainer/portainer/file"
|
"github.com/portainer/portainer/filesystem"
|
||||||
httperror "github.com/portainer/portainer/http/error"
|
httperror "github.com/portainer/portainer/http/error"
|
||||||
"github.com/portainer/portainer/http/security"
|
"github.com/portainer/portainer/http/security"
|
||||||
|
|
||||||
|
@ -138,11 +138,11 @@ func (handler *SettingsHandler) handlePutSettings(w http.ResponseWriter, r *http
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settings.LDAPSettings.TLSConfig.TLS || settings.LDAPSettings.StartTLS) && !settings.LDAPSettings.TLSConfig.TLSSkipVerify {
|
if (settings.LDAPSettings.TLSConfig.TLS || settings.LDAPSettings.StartTLS) && !settings.LDAPSettings.TLSConfig.TLSSkipVerify {
|
||||||
caCertPath, _ := handler.FileService.GetPathForTLSFile(file.LDAPStorePath, portainer.TLSFileCA)
|
caCertPath, _ := handler.FileService.GetPathForTLSFile(filesystem.LDAPStorePath, portainer.TLSFileCA)
|
||||||
settings.LDAPSettings.TLSConfig.TLSCACertPath = caCertPath
|
settings.LDAPSettings.TLSConfig.TLSCACertPath = caCertPath
|
||||||
} else {
|
} else {
|
||||||
settings.LDAPSettings.TLSConfig.TLSCACertPath = ""
|
settings.LDAPSettings.TLSConfig.TLSCACertPath = ""
|
||||||
err := handler.FileService.DeleteTLSFiles(file.LDAPStorePath)
|
err := handler.FileService.DeleteTLSFiles(filesystem.LDAPStorePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
httperror.WriteErrorResponse(w, err, http.StatusInternalServerError, handler.Logger)
|
httperror.WriteErrorResponse(w, err, http.StatusInternalServerError, handler.Logger)
|
||||||
}
|
}
|
||||||
|
@ -169,7 +169,7 @@ func (handler *SettingsHandler) handlePutSettingsLDAPCheck(w http.ResponseWriter
|
||||||
}
|
}
|
||||||
|
|
||||||
if (req.LDAPSettings.TLSConfig.TLS || req.LDAPSettings.StartTLS) && !req.LDAPSettings.TLSConfig.TLSSkipVerify {
|
if (req.LDAPSettings.TLSConfig.TLS || req.LDAPSettings.StartTLS) && !req.LDAPSettings.TLSConfig.TLSSkipVerify {
|
||||||
caCertPath, _ := handler.FileService.GetPathForTLSFile(file.LDAPStorePath, portainer.TLSFileCA)
|
caCertPath, _ := handler.FileService.GetPathForTLSFile(filesystem.LDAPStorePath, portainer.TLSFileCA)
|
||||||
req.LDAPSettings.TLSConfig.TLSCACertPath = caCertPath
|
req.LDAPSettings.TLSConfig.TLSCACertPath = caCertPath
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ import (
|
||||||
|
|
||||||
"github.com/asaskevich/govalidator"
|
"github.com/asaskevich/govalidator"
|
||||||
"github.com/portainer/portainer"
|
"github.com/portainer/portainer"
|
||||||
"github.com/portainer/portainer/file"
|
"github.com/portainer/portainer/filesystem"
|
||||||
httperror "github.com/portainer/portainer/http/error"
|
httperror "github.com/portainer/portainer/http/error"
|
||||||
"github.com/portainer/portainer/http/proxy"
|
"github.com/portainer/portainer/http/proxy"
|
||||||
"github.com/portainer/portainer/http/security"
|
"github.com/portainer/portainer/http/security"
|
||||||
|
@ -166,7 +166,7 @@ func (handler *StackHandler) handlePostStacksStringMethod(w http.ResponseWriter,
|
||||||
ID: portainer.StackID(stackName + "_" + swarmID),
|
ID: portainer.StackID(stackName + "_" + swarmID),
|
||||||
Name: stackName,
|
Name: stackName,
|
||||||
SwarmID: swarmID,
|
SwarmID: swarmID,
|
||||||
EntryPoint: file.ComposeFileDefaultName,
|
EntryPoint: filesystem.ComposeFileDefaultName,
|
||||||
Env: req.Env,
|
Env: req.Env,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -264,7 +264,7 @@ func (handler *StackHandler) handlePostStacksRepositoryMethod(w http.ResponseWri
|
||||||
}
|
}
|
||||||
|
|
||||||
if req.PathInRepository == "" {
|
if req.PathInRepository == "" {
|
||||||
req.PathInRepository = file.ComposeFileDefaultName
|
req.PathInRepository = filesystem.ComposeFileDefaultName
|
||||||
}
|
}
|
||||||
|
|
||||||
stacks, err := handler.StackService.Stacks()
|
stacks, err := handler.StackService.Stacks()
|
||||||
|
@ -404,7 +404,7 @@ func (handler *StackHandler) handlePostStacksFileMethod(w http.ResponseWriter, r
|
||||||
ID: portainer.StackID(stackName + "_" + swarmID),
|
ID: portainer.StackID(stackName + "_" + swarmID),
|
||||||
Name: stackName,
|
Name: stackName,
|
||||||
SwarmID: swarmID,
|
SwarmID: swarmID,
|
||||||
EntryPoint: file.ComposeFileDefaultName,
|
EntryPoint: filesystem.ComposeFileDefaultName,
|
||||||
Env: env,
|
Env: env,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue