Fix config for automated tests
This commit is contained in:
@@ -111,3 +111,17 @@ func LoadConfig() Config {
|
||||
|
||||
return cfg.ConfigFile
|
||||
}
|
||||
|
||||
// used for testing
|
||||
func LoadConfigFromFile(configPath string) Config {
|
||||
f, err := os.ReadFile(configPath)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
var config Config
|
||||
err = toml.Unmarshal(f, &config)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return config
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ import (
|
||||
)
|
||||
|
||||
func TestSetup() *gin.Engine {
|
||||
c := config.LoadConfig("config_test/test.toml")
|
||||
c := config.LoadConfigFromFile("config_test/test.toml")
|
||||
return setup.Setup(&c)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user