Change to using yml for configuration files
This commit is contained in:
@@ -10,6 +10,7 @@ func LoadConfiguration(path string) error {
|
||||
viper.SetConfigFile(path)
|
||||
} else {
|
||||
viper.AddConfigPath("./")
|
||||
viper.SetConfigType("yaml")
|
||||
viper.SetConfigName("config")
|
||||
}
|
||||
|
||||
@@ -49,7 +50,7 @@ func setDefaults() {
|
||||
|
||||
// ContainsAuthKey checks wether the config contains a specified authentication key
|
||||
func ContainsAuthKey(key string) bool {
|
||||
for _, k := range viper.GetStringSlice(AuthKeys) {
|
||||
for _, k := range viper.GetStringSlice(AuthKey) {
|
||||
if k == key {
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
const configFile = "../config.example.json"
|
||||
const configFile = "../config.yml.example"
|
||||
|
||||
func TestLoadConfiguraiton(t *testing.T) {
|
||||
err := LoadConfiguration(configFile)
|
||||
|
||||
@@ -21,7 +21,7 @@ const (
|
||||
SSLGenerateLetsencrypt = "api.ssl.letsencrypt"
|
||||
// SSLCertificate is a string containing the location of
|
||||
// a ssl certificate to use
|
||||
SSLCertificate = "api.ssl.certificate"
|
||||
SSLCertificate = "api.ssl.cert"
|
||||
// SSLKey is a string containing the location of the key
|
||||
// for the ssl certificate
|
||||
SSLKey = "api.ssl.key"
|
||||
@@ -61,6 +61,6 @@ const (
|
||||
// logs should be stored. They will be deleted after. If set to 0
|
||||
// logs will be stored indefinitely.
|
||||
LogDeleteAfterDays = "log.deleteAfterDays"
|
||||
// AuthKeys contains an array of auth keys that will be replaced by something better
|
||||
AuthKeys = "authkeys"
|
||||
// AuthKey contains a key that will be replaced by something better
|
||||
AuthKey = "authKey"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user