blob: b3a33146286154b4b0c1de352a47de167180f209 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
// Copyright (C) 2021-2021 The Whirlsplash Collective
// SPDX-License-Identifier: GPL-3.0-only
package config
import (
"github.com/spf13/viper"
"log"
)
func Setup() {
viper.SetConfigName("config.yml")
viper.SetConfigType("yaml")
viper.AddConfigPath(".")
if err := viper.ReadInConfig(); err != nil {
if _, ok := err.(viper.ConfigFileNotFoundError); ok {
log.Panicln("Cannot read configuration file:", err)
} else {
log.Panicln("Read configuration file but an error occurred anyway:", err)
}
}
viper.WatchConfig()
}
|