2017-06-29 10:21:59 +00:00
|
|
|
package command
|
|
|
|
|
|
|
|
import (
|
2017-07-01 17:26:05 +00:00
|
|
|
"github.com/Pterodactyl/wings/api"
|
|
|
|
"github.com/Pterodactyl/wings/config"
|
2017-07-06 18:51:27 +00:00
|
|
|
"github.com/Pterodactyl/wings/constants"
|
2017-07-01 17:26:05 +00:00
|
|
|
"github.com/Pterodactyl/wings/tools"
|
2017-06-29 10:21:59 +00:00
|
|
|
log "github.com/sirupsen/logrus"
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
)
|
|
|
|
|
2017-07-06 18:51:27 +00:00
|
|
|
// RootCommand is the root command of wings
|
2017-06-29 10:21:59 +00:00
|
|
|
var RootCommand = &cobra.Command{
|
|
|
|
Use: "wings",
|
|
|
|
Short: "",
|
|
|
|
Long: "",
|
|
|
|
Run: run,
|
|
|
|
}
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2017-07-06 18:51:27 +00:00
|
|
|
// Execute registers the RootCommand
|
2017-06-29 10:21:59 +00:00
|
|
|
func Execute() {
|
|
|
|
RootCommand.Execute()
|
|
|
|
}
|
|
|
|
|
|
|
|
func run(cmd *cobra.Command, args []string) {
|
2017-07-06 17:01:08 +00:00
|
|
|
tools.InitLogging()
|
|
|
|
log.Info("Loading configuration")
|
2017-07-06 18:51:27 +00:00
|
|
|
if err := config.LoadConfiguration(""); err != nil {
|
2017-06-29 10:21:59 +00:00
|
|
|
log.WithError(err).Fatal("Failed to find configuration file")
|
|
|
|
}
|
|
|
|
tools.ConfigureLogging()
|
|
|
|
|
2017-07-06 17:01:08 +00:00
|
|
|
log.Info(` ____`)
|
|
|
|
log.Info(`__ Pterodactyl _____/___/_______ _______ ______`)
|
|
|
|
log.Info(`\_____\ \/\/ / / / __ / ___/`)
|
|
|
|
log.Info(` \___\ / / / / /_/ /___ /`)
|
|
|
|
log.Info(` \___/\___/___/___/___/___ /______/`)
|
2017-07-06 18:51:27 +00:00
|
|
|
log.Info(` /_______/ v` + constants.Version)
|
2017-07-06 17:01:08 +00:00
|
|
|
log.Info()
|
2017-06-29 10:21:59 +00:00
|
|
|
|
2017-07-06 17:01:08 +00:00
|
|
|
log.Info("Configuration loaded successfully.")
|
2017-06-29 10:21:59 +00:00
|
|
|
|
|
|
|
log.Info("Starting api webserver")
|
|
|
|
api := api.NewAPI()
|
|
|
|
api.Listen()
|
|
|
|
}
|