Probably breaks everything, lowercase pterodactyl

This commit is contained in:
Dane Everitt 2018-02-20 13:33:32 -06:00
parent 3f07cdb4c0
commit bacdfae768
No known key found for this signature in database
GPG Key ID: EEA66103B3D71F53
19 changed files with 124 additions and 69 deletions

View File

@ -2,7 +2,7 @@
Pterodactyl go Daemon Vagrant VM
Gopath: /home/ubuntu/go
Daemon: /home/ubuntu/go/src/github.com/Pterodactyl/wings.go
Daemon: /home/ubuntu/go/src/github.com/pterodactyl/wings.go
Data: /srv/daemon-data
#####################################################

View File

@ -1,7 +1,7 @@
#!/bin/bash
echo "Provisioning development environment for Pterodactyl go daemon."
cp /home/ubuntu/go/github.com/Pterodactyl/wings.go/.dev/vagrant/motd.txt /etc/motd
cp /home/ubuntu/go/github.com/pterodactyl/wings.go/.dev/vagrant/motd.txt /etc/motd
chown -R ubuntu:ubuntu /home/ubuntu/go
chown -R ubuntu:ubuntu /srv
@ -32,5 +32,5 @@ apt-get -y install mercurial #tar unzip make gcc g++ python > /dev/null
echo " ------------"
echo "Gopath is /home/ubuntu/go"
echo "The project is mounted to /home/ubuntu/go/src/github.com/Pterodactyl/wings.go"
echo "The project is mounted to /home/ubuntu/go/src/github.com/pterodactyl/wings.go"
echo "Provisioning is completed."

11
Gopkg.lock generated
View File

@ -24,7 +24,7 @@
[[projects]]
branch = "develop"
name = "github.com/Pterodactyl/wings"
name = "github.com/pterodactyl/wings"
packages = [
"api",
"config",
@ -251,18 +251,11 @@
"host",
"internal/common",
"mem",
"net",
"process"
]
revision = "c432be29ccce470088d07eea25b3ea7e68a8afbb"
version = "v2.18.01"
[[projects]]
branch = "master"
name = "github.com/shirou/w32"
packages = ["."]
revision = "bb4de0191aa41b5507caa14b0650cdbddcd9280b"
[[projects]]
name = "github.com/sirupsen/logrus"
packages = ["."]
@ -372,6 +365,6 @@
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "7f394f53c7f2fc5250192ef95a878bfa397ab1d68cb69d7ab470adb4ea216294"
inputs-digest = "3f6a265d298db6e8379b05d796fcdff3d78a0216b6aaaccd4501440cbcfc0792"
solver-name = "gps-cdcl"
solver-version = 1

View File

@ -25,9 +25,9 @@
# unused-packages = true
[[constraint]]
branch = "develop"
name = "github.com/Pterodactyl/wings"
#[[constraint]]
# branch = "develop"
# name = "github.com/pterodactyl/wings"
[[constraint]]
name = "github.com/gin-gonic/gin"

View File

@ -1,4 +1,4 @@
# Pterodactyl wings [![travis](https://img.shields.io/travis/Pterodactyl/wings.svg?style=flat-square)](https://travis-ci.org/Pterodactyl/wings) [![codacy quality](https://img.shields.io/codacy/grade/27a1576bda86450f853b1052b12fa570.svg?style=flat-square)](https://www.codacy.com/app/schrej/wings/dashboard) [![codacy coverage](https://img.shields.io/codacy/coverage/27a1576bda86450f853b1052b12fa570.svg?style=flat-square)](https://www.codacy.com/app/schrej/wings/files)
# Pterodactyl wings [![travis](https://img.shields.io/travis/pterodactyl/wings.svg?style=flat-square)](https://travis-ci.org/pterodactyl/wings) [![codacy quality](https://img.shields.io/codacy/grade/27a1576bda86450f853b1052b12fa570.svg?style=flat-square)](https://www.codacy.com/app/schrej/wings/dashboard) [![codacy coverage](https://img.shields.io/codacy/coverage/27a1576bda86450f853b1052b12fa570.svg?style=flat-square)](https://www.codacy.com/app/schrej/wings/files)
```
____

2
Vagrantfile vendored
View File

@ -1,7 +1,7 @@
Vagrant.configure("2") do |cfg|
cfg.vm.box = "ubuntu/xenial64"
cfg.vm.synced_folder "./", "/home/ubuntu/go/src/github.com/Pterodactyl/wings"
cfg.vm.synced_folder "./", "/home/ubuntu/go/src/github.com/pterodactyl/wings"
cfg.vm.provision :shell, path: ".dev/vagrant/provision.sh"

View File

@ -8,7 +8,7 @@ import (
log "github.com/sirupsen/logrus"
"github.com/spf13/viper"
"github.com/Pterodactyl/wings/config"
"github.com/pterodactyl/wings/config"
)
type InternalAPI struct {

View File

@ -3,9 +3,9 @@ package api
import (
"net/http"
"github.com/Pterodactyl/wings/config"
"github.com/Pterodactyl/wings/control"
"github.com/gin-gonic/gin"
"github.com/pterodactyl/wings/config"
"github.com/pterodactyl/wings/control"
log "github.com/sirupsen/logrus"
)

View File

@ -8,8 +8,8 @@ import (
"github.com/gin-gonic/gin"
"github.com/stretchr/testify/assert"
"github.com/Pterodactyl/wings/config"
"github.com/Pterodactyl/wings/control"
"github.com/pterodactyl/wings/config"
"github.com/pterodactyl/wings/control"
)
const configFile = "_testdata/config.yml"

View File

@ -4,8 +4,8 @@ import (
"net/http"
"runtime"
"github.com/Pterodactyl/wings/constants"
"github.com/gin-gonic/gin"
"github.com/pterodactyl/wings/constants"
"github.com/shirou/gopsutil/cpu"
"github.com/shirou/gopsutil/host"
"github.com/shirou/gopsutil/mem"

View File

@ -3,8 +3,8 @@ package api
import (
"net/http"
"github.com/Pterodactyl/wings/control"
"github.com/gin-gonic/gin"
"github.com/pterodactyl/wings/control"
log "github.com/sirupsen/logrus"
)

View File

@ -8,8 +8,8 @@ import (
"net/http/httptest"
"testing"
"github.com/Pterodactyl/wings/control"
"github.com/gin-gonic/gin"
"github.com/pterodactyl/wings/control"
"github.com/stretchr/testify/assert"
)

View File

@ -1,8 +1,8 @@
package api
import (
"github.com/Pterodactyl/wings/control"
"github.com/gin-gonic/gin"
"github.com/pterodactyl/wings/control"
)
func getServerFromContext(context *gin.Context) control.Server {

View File

@ -6,11 +6,11 @@ import (
"github.com/spf13/viper"
"github.com/Pterodactyl/wings/api"
"github.com/Pterodactyl/wings/config"
"github.com/Pterodactyl/wings/constants"
"github.com/Pterodactyl/wings/control"
"github.com/Pterodactyl/wings/utils"
"github.com/pterodactyl/wings/api"
"github.com/pterodactyl/wings/config"
"github.com/pterodactyl/wings/constants"
"github.com/pterodactyl/wings/control"
"github.com/pterodactyl/wings/utils"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)

View File

@ -6,7 +6,7 @@ import (
"os"
"strings"
"github.com/Pterodactyl/wings/constants"
"github.com/pterodactyl/wings/constants"
"github.com/fsouza/go-dockerclient"
log "github.com/sirupsen/logrus"

View File

@ -8,8 +8,8 @@ import (
"path/filepath"
"strings"
"github.com/Pterodactyl/wings/config"
"github.com/Pterodactyl/wings/constants"
"github.com/pterodactyl/wings/config"
"github.com/pterodactyl/wings/constants"
log "github.com/sirupsen/logrus"
"github.com/spf13/viper"
)

77
main.go Normal file
View File

@ -0,0 +1,77 @@
package main
import (
"fmt"
"os"
"path/filepath"
"strconv"
"github.com/pterodactyl/wings/api"
"github.com/pterodactyl/wings/command"
"github.com/pterodactyl/wings/config"
"github.com/pterodactyl/wings/constants"
"github.com/pterodactyl/wings/control"
"github.com/pterodactyl/wings/utils"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
func main() {
if err := command.RootCommand.Execute(); err != nil {
fmt.Println(err)
os.Exit(1)
}
}
// RootCommand is the root command of wings
var RootCommand = &cobra.Command{
Use: "wings",
Short: "",
Long: "",
Run: run,
}
var configPath string
func init() {
RootCommand.Flags().StringVarP(&configPath, "config", "c", "./config.yml", "Allows to set the path of the configuration file.")
}
// Execute registers the RootCommand
func Execute() {
RootCommand.Execute()
}
func run(cmd *cobra.Command, args []string) {
utils.InitLogging()
logrus.Info("Loading configuration...")
if err := config.LoadConfiguration(configPath); err != nil {
logrus.WithError(err).Fatal("Failed to find configuration file")
}
utils.ConfigureLogging()
logrus.Info(` ____`)
logrus.Info(`__ Pterodactyl _____/___/_______ _______ ______`)
logrus.Info(`\_____\ \/\/ / / / __ / ___/`)
logrus.Info(` \___\ / / / / /_/ /___ /`)
logrus.Info(` \___/\___/___/___/___/___ /______/`)
logrus.Info(` /_______/ v` + constants.Version)
logrus.Info()
logrus.Info("Configuration loaded successfully.")
logrus.Info("Loading configured servers...")
if err := control.LoadServerConfigurations(filepath.Join(viper.GetString(config.DataPath), constants.ServersPath)); err != nil {
logrus.WithError(err).Error("Failed to load configured servers.")
}
if amount := len(control.GetServers()); amount == 1 {
logrus.Info("Loaded 1 server.")
} else {
logrus.Info("Loaded " + strconv.Itoa(amount) + " servers.")
}
logrus.Info("Starting API Server...")
a := api.NewAPI()
a.Listen()
}

View File

@ -1,18 +1,18 @@
package tools
package utils
import (
"os"
"path/filepath"
"time"
//"time"
"github.com/Pterodactyl/wings/constants"
"github.com/pterodactyl/wings/constants"
rotatelogs "github.com/lestrrat/go-file-rotatelogs"
"github.com/rifflock/lfshook"
//"github.com/lestrrat/go-file-rotatelogs"
//"github.com/rifflock/lfshook"
log "github.com/sirupsen/logrus"
"github.com/spf13/viper"
"github.com/Pterodactyl/wings/config"
"github.com/pterodactyl/wings/config"
)
// InitLogging initalizes the logging library for first use.
@ -30,20 +30,20 @@ func ConfigureLogging() error {
if err := os.MkdirAll(path, constants.DefaultFolderPerms); err != nil {
return err
}
writer := rotatelogs.New(
path+"/wings.%Y%m%d-%H%M.log",
rotatelogs.WithLinkName(path),
rotatelogs.WithMaxAge(time.Duration(viper.GetInt(config.LogDeleteAfterDays))*time.Hour*24),
rotatelogs.WithRotationTime(time.Duration(604800)*time.Second),
)
log.AddHook(lfshook.NewHook(lfshook.WriterMap{
log.DebugLevel: writer,
log.InfoLevel: writer,
log.WarnLevel: writer,
log.ErrorLevel: writer,
log.FatalLevel: writer,
}))
//writer := rotatelogs.New(
// path+"/wings.%Y%m%d-%H%M.log",
// rotatelogs.WithLinkName(path),
// rotatelogs.WithMaxAge(time.Duration(viper.GetInt(config.LogDeleteAfterDays))*time.Hour*24),
// rotatelogs.WithRotationTime(time.Duration(604800)*time.Second),
//)
//
//log.AddHook(lfshook.NewHook(lfshook.WriterMap{
// log.DebugLevel: writer,
// log.InfoLevel: writer,
// log.WarnLevel: writer,
// log.ErrorLevel: writer,
// log.FatalLevel: writer,
//}))
level := viper.GetString(config.LogLevel)

View File

@ -1,15 +0,0 @@
package main
import (
"fmt"
"os"
"github.com/pterodactyl/wings/command"
)
func main() {
if err := command.RootCommand.Execute(); err != nil {
fmt.Println(err)
os.Exit(1)
}
}