Commit 6adf24d5 authored by Sandeep S. Shewalkar's avatar Sandeep S. Shewalkar
Browse files

Merge branch 'stagingbranch' into 'master'

uncommented the code

See merge request !15
parents ad42299b 6babf86b
1 merge request!15uncommented the code
Showing with 15 additions and 12 deletions
package confighelper
import (
"fmt"
"github.com/spf13/viper"
)
//InitViper function to initialize viper
func InitViper() {
// viper.SetConfigName("config") // name of config file (without extension)
// viper.AddConfigPath(".") // optionally look for config in the working directory
// err := viper.ReadInConfig()
// // Find and read the config file
// if err != nil { // Handle errors reading the config file
// panic(fmt.Errorf("Fatal error config file %s ", err))
// }
viper.SetConfigName("config") // name of config file (without extension)
viper.AddConfigPath(".") // optionally look for config in the working directory
err := viper.ReadInConfig()
// Find and read the config file
if err != nil { // Handle errors reading the config file
panic(fmt.Errorf("Fatal error config file %s ", err))
}
}
//GetConfig method to get configs from config file
func GetConfig(keyName string) string {
// keyValue := viper.GetString(keyName)
// return keyValue
return ""
keyValue := viper.GetString(keyName)
return keyValue
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment