From 55ec4af87593f5bb9f77df712bd48472c8140d77 Mon Sep 17 00:00:00 2001 From: Jakob Schrettenbrunner Date: Thu, 6 Jul 2017 20:51:27 +0200 Subject: [PATCH] add constants package for constants --- command/root.go | 12 +++++------- constants/constants.go | 4 ++++ 2 files changed, 9 insertions(+), 7 deletions(-) create mode 100644 constants/constants.go diff --git a/command/root.go b/command/root.go index 5e492f4..9eb059d 100644 --- a/command/root.go +++ b/command/root.go @@ -3,16 +3,13 @@ package command import ( "github.com/Pterodactyl/wings/api" "github.com/Pterodactyl/wings/config" + "github.com/Pterodactyl/wings/constants" "github.com/Pterodactyl/wings/tools" log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) -const ( - // Version of pterodactyld - Version = "0.0.1-alpha" -) - +// RootCommand is the root command of wings var RootCommand = &cobra.Command{ Use: "wings", Short: "", @@ -24,6 +21,7 @@ func init() { } +// Execute registers the RootCommand func Execute() { RootCommand.Execute() } @@ -31,7 +29,7 @@ func Execute() { func run(cmd *cobra.Command, args []string) { tools.InitLogging() 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") } tools.ConfigureLogging() @@ -41,7 +39,7 @@ func run(cmd *cobra.Command, args []string) { log.Info(`\_____\ \/\/ / / / __ / ___/`) log.Info(` \___\ / / / / /_/ /___ /`) log.Info(` \___/\___/___/___/___/___ /______/`) - log.Info(` /_______/ v` + Version) + log.Info(` /_______/ v` + constants.Version) log.Info() log.Info("Configuration loaded successfully.") diff --git a/constants/constants.go b/constants/constants.go new file mode 100644 index 0000000..c5918de --- /dev/null +++ b/constants/constants.go @@ -0,0 +1,4 @@ +package constants + +// Version is the current wings version +const Version = "0.0.1-alpha"