Change default config path for the portal

This commit is contained in:
2022-05-13 22:03:36 +02:00
parent 879546cd1d
commit 5bd76e6048

View File

@@ -5,7 +5,6 @@ import (
"crypto/tls" "crypto/tls"
"fmt" "fmt"
"os" "os"
"path/filepath"
"github.com/apex/log" "github.com/apex/log"
jsonhandler "github.com/apex/log/handlers/json" jsonhandler "github.com/apex/log/handlers/json"
@@ -71,11 +70,8 @@ func Execute() {
}, },
} }
dir := "/etc/portal"
configPath := filepath.Join(dir, "config.toml")
cobra.OnInitialize(initConfig) cobra.OnInitialize(initConfig)
rootCmd.PersistentFlags().StringVarP(&cfgFile, "config", "c", configPath, "config file") rootCmd.PersistentFlags().StringVarP(&cfgFile, "config", "c", "config.toml", "config file")
rootCmd.PersistentFlags().StringP("loglevel", "l", "info", "Log level") rootCmd.PersistentFlags().StringP("loglevel", "l", "info", "Log level")
rootCmd.PersistentFlags().BoolP("json", "j", false, "Output logs in JSON format") rootCmd.PersistentFlags().BoolP("json", "j", false, "Output logs in JSON format")
rootCmd.Flags().IntP("port", "p", 1337, "Port to listen on for connections") rootCmd.Flags().IntP("port", "p", 1337, "Port to listen on for connections")