add constants package for constants

This commit is contained in:
Jakob Schrettenbrunner 2017-07-06 20:51:27 +02:00
parent ec937603fd
commit 55ec4af875
2 changed files with 9 additions and 7 deletions

View File

@ -3,16 +3,13 @@ package command
import ( import (
"github.com/Pterodactyl/wings/api" "github.com/Pterodactyl/wings/api"
"github.com/Pterodactyl/wings/config" "github.com/Pterodactyl/wings/config"
"github.com/Pterodactyl/wings/constants"
"github.com/Pterodactyl/wings/tools" "github.com/Pterodactyl/wings/tools"
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
const ( // RootCommand is the root command of wings
// Version of pterodactyld
Version = "0.0.1-alpha"
)
var RootCommand = &cobra.Command{ var RootCommand = &cobra.Command{
Use: "wings", Use: "wings",
Short: "", Short: "",
@ -24,6 +21,7 @@ func init() {
} }
// Execute registers the RootCommand
func Execute() { func Execute() {
RootCommand.Execute() RootCommand.Execute()
} }
@ -31,7 +29,7 @@ func Execute() {
func run(cmd *cobra.Command, args []string) { func run(cmd *cobra.Command, args []string) {
tools.InitLogging() tools.InitLogging()
log.Info("Loading configuration") log.Info("Loading configuration")
if err := config.LoadConfiguration(nil); err != nil { if err := config.LoadConfiguration(""); err != nil {
log.WithError(err).Fatal("Failed to find configuration file") log.WithError(err).Fatal("Failed to find configuration file")
} }
tools.ConfigureLogging() tools.ConfigureLogging()
@ -41,7 +39,7 @@ func run(cmd *cobra.Command, args []string) {
log.Info(`\_____\ \/\/ / / / __ / ___/`) log.Info(`\_____\ \/\/ / / / __ / ___/`)
log.Info(` \___\ / / / / /_/ /___ /`) log.Info(` \___\ / / / / /_/ /___ /`)
log.Info(` \___/\___/___/___/___/___ /______/`) log.Info(` \___/\___/___/___/___/___ /______/`)
log.Info(` /_______/ v` + Version) log.Info(` /_______/ v` + constants.Version)
log.Info() log.Info()
log.Info("Configuration loaded successfully.") log.Info("Configuration loaded successfully.")

4
constants/constants.go Normal file
View File

@ -0,0 +1,4 @@
package constants
// Version is the current wings version
const Version = "0.0.1-alpha"