[WIP] add viper to manage envvars and cfg files

This commit is contained in:
1138-4EB
2019-01-06 06:11:15 +01:00
parent 09a6ffb1f3
commit 1080bfde68
7 changed files with 261 additions and 111 deletions

View File

@@ -9,6 +9,7 @@ import (
"github.com/asdine/storm"
"github.com/filebrowser/filebrowser/v2/settings"
"github.com/spf13/cobra"
v "github.com/spf13/viper"
)
func init() {
@@ -28,6 +29,7 @@ to the defaults when creating new users and you don't
override the options.`,
Args: cobra.NoArgs,
Run: func(cmd *cobra.Command, args []string) {
databasePath := v.GetString("database")
if _, err := os.Stat(databasePath); err == nil {
panic(errors.New(databasePath + " already exists"))
}