parent
4dd55ccc78
commit
2e56c1daa6
@ -1,14 +1,25 @@ |
|||||||
package main |
package main |
||||||
|
|
||||||
import ( |
import ( |
||||||
|
"fmt" |
||||||
|
|
||||||
"github.com/sirupsen/logrus" |
"github.com/sirupsen/logrus" |
||||||
"github.com/spf13/viper" |
"github.com/spf13/viper" |
||||||
) |
) |
||||||
|
|
||||||
|
var Version = "nightly" |
||||||
|
|
||||||
func main() { |
func main() { |
||||||
|
|
||||||
|
if viper.GetBool("version") { |
||||||
|
fmt.Print(Version) |
||||||
|
return |
||||||
|
} |
||||||
|
|
||||||
viper.SetConfigFile(viper.GetString("config")) |
viper.SetConfigFile(viper.GetString("config")) |
||||||
if err := viper.ReadInConfig(); err != nil { |
if err := viper.ReadInConfig(); err != nil { |
||||||
logrus.Debugf("Skip invalid config file %s, %v", viper.ConfigFileUsed(), err) |
logrus.Debugf("Skip invalid config file %s, %v", viper.ConfigFileUsed(), err) |
||||||
} |
} |
||||||
|
|
||||||
|
logrus.Infof("Version: %s", Version) |
||||||
} |
} |
||||||
|
Loading…
Reference in new issue