aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/root.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/root.go')
-rw-r--r--cmd/root.go22
1 files changed, 13 insertions, 9 deletions
diff --git a/cmd/root.go b/cmd/root.go
index 0a7d0e6..b3b8395 100644
--- a/cmd/root.go
+++ b/cmd/root.go
@@ -27,11 +27,13 @@ import (
var rootCmd = &cobra.Command{
Use: "guestbook",
- Version: "v1.6.2",
+ Version: "v1.7.0",
Short: "Standalone guestbook server for static websites",
Long: "Standalone guestbook server for static websites",
}
+var defaultGuestbook string = "my_guestbook"
+
func Execute() {
err := rootCmd.Execute()
if err != nil {
@@ -40,12 +42,14 @@ func Execute() {
}
func init() {
- cobra.OnInitialize(func () {
- viper.SetConfigName("guestbook")
- viper.AddConfigPath("/etc")
-
- if err := viper.ReadInConfig(); err != nil {
- log.Fatal(err)
- }
- })
+ viper.SetConfigName("guestbook")
+ viper.AddConfigPath("/etc")
+
+ if err := viper.ReadInConfig(); err != nil {
+ log.Fatal(err)
+ }
+
+ if viper.IsSet("default_guestbook") {
+ defaultGuestbook = viper.GetString("default_guestbook")
+ }
}