Add base support for internalizing the SFTP server

This commit is contained in:
Dane Everitt
2019-12-07 14:01:40 -08:00
parent e1435bfe8f
commit 52ca0667ca
5 changed files with 83 additions and 9 deletions

View File

@@ -8,9 +8,11 @@ import (
"github.com/pkg/errors"
"github.com/pterodactyl/wings/config"
"github.com/pterodactyl/wings/server"
"github.com/pterodactyl/wings/sftp"
"github.com/remeh/sizedwaitgroup"
"go.uber.org/zap"
"net/http"
"os"
)
// Entrypoint for the Wings application. Configures the logger and checks any
@@ -137,6 +139,14 @@ func main() {
// Wait until all of the servers are ready to go before we fire up the HTTP server.
wg.Wait()
// If the SFTP subsystem should be started, do so now.
if c.System.Sftp.UseInternalSystem {
if err := sftp.Initialize(c); err != nil {
zap.S().Fatalw("failed to initialize SFTP subsystem", zap.Error(errors.WithStack(err)))
os.Exit(1)
}
}
r := &Router{
Servers: servers,
token: c.AuthenticationToken,