package config_init

import (
	"olympus/oncall/backend/pkg/log"

	"github.com/spf13/viper"
)

func SetUpConfig(mode string) {
	if mode == "Deploy" {
		log.Info("msg", "Deploy mode")
		viper.SetConfigName("config") // name of config file (without extension)
	} else {
		log.Info("msg", "Debug mode")
		viper.SetConfigName("config-test") // name of config file (without extension)
	}
	viper.SetConfigType("yml")   // REQUIRED if the config file does not have the extension in the name
	viper.AddConfigPath("./etc") // 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
		log.Error("msg", "error: setup config")
	}
}
