Skip to content

Commit

Permalink
fix: add standard search paths to viper
Browse files Browse the repository at this point in the history
Signed-off-by: Khaled Emara <mail@KhaledEmara.dev>
  • Loading branch information
KhaledEmaraDev committed Apr 4, 2023
1 parent 6c5cbde commit 9cb80eb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ package config

import (
"fmt"
"github.com/spf13/viper"
"icapeg/logging"
"icapeg/readValues"
"os"

"github.com/spf13/viper"
)

type serviceIcapInfo struct {
Expand Down Expand Up @@ -39,6 +40,9 @@ var AppCfg AppConfig
func Init() {
viper.SetConfigName("config")
viper.SetConfigType("toml")
viper.AddConfigPath("/etc/icapeg/")
viper.AddConfigPath("/usr/local/etc/icapeg/")
viper.AddConfigPath("$HOME/.config/icapeg")
viper.AddConfigPath(".")
if readValues.IsSecExists("app") {
fmt.Println("app section doesn't exist in config file")
Expand Down

0 comments on commit 9cb80eb

Please sign in to comment.