28 lines
422 B
Go
28 lines
422 B
Go
package inits
|
|
|
|
import (
|
|
"gopkg.in/yaml.v3"
|
|
"misso/config"
|
|
"os"
|
|
)
|
|
|
|
func Config() error {
|
|
// Read config file
|
|
configFilePosition, exist := os.LookupEnv("CONFIG_FILE_PATH")
|
|
if !exist {
|
|
configFilePosition = "config.yml"
|
|
}
|
|
|
|
configFileBytes, err := os.ReadFile(configFilePosition)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
err = yaml.Unmarshal(configFileBytes, &config.Config)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|