gitea-sonarqube-bot/internal/settings/settings.go
justusbunsi 706aeb0d0f
Load config.yaml from config directory
Signed-off-by: Steven Kriegler <61625851+justusbunsi@users.noreply.github.com>
2021-06-20 15:16:06 +02:00

20 lines
322 B
Go

package settings
import (
"fmt"
"github.com/spf13/viper"
)
func Load(configPath string) {
viper.SetConfigName("config.yaml")
viper.SetConfigType("yaml")
viper.AddConfigPath(configPath)
err := viper.ReadInConfig()
if err != nil {
panic(fmt.Errorf("Fatal error while reading config file: %w \n", err))
}
}