summaryrefslogtreecommitdiff
path: root/testrig/router.go
diff options
context:
space:
mode:
Diffstat (limited to 'testrig/router.go')
-rw-r--r--testrig/router.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/testrig/router.go b/testrig/router.go
index 468b468c6..e06e21bd4 100644
--- a/testrig/router.go
+++ b/testrig/router.go
@@ -26,7 +26,6 @@ import (
"runtime"
"github.com/gin-gonic/gin"
- "github.com/spf13/viper"
"github.com/superseriousbusiness/gotosocial/internal/config"
"github.com/superseriousbusiness/gotosocial/internal/db"
"github.com/superseriousbusiness/gotosocial/internal/router"
@@ -38,11 +37,13 @@ import (
// value as the template base directory instead.
func NewTestRouter(db db.DB) router.Router {
if alternativeTemplateBaseDir := os.Getenv("GTS_WEB_TEMPLATE_BASE_DIR"); alternativeTemplateBaseDir != "" {
- viper.Set(config.Keys.WebTemplateBaseDir, alternativeTemplateBaseDir)
+ config.Config(func(cfg *config.Configuration) {
+ cfg.WebTemplateBaseDir = alternativeTemplateBaseDir
+ })
}
if alternativeBindAddress := os.Getenv("GTS_BIND_ADDRESS"); alternativeBindAddress != "" {
- viper.Set(config.Keys.BindAddress, alternativeBindAddress)
+ config.SetBindAddress(alternativeBindAddress)
}
r, err := router.New(context.Background(), db)
@@ -56,7 +57,7 @@ func NewTestRouter(db db.DB) router.Router {
func ConfigureTemplatesWithGin(engine *gin.Engine) {
router.LoadTemplateFunctions(engine)
- templateBaseDir := viper.GetString(config.Keys.WebTemplateBaseDir)
+ templateBaseDir := config.GetWebTemplateBaseDir()
if !filepath.IsAbs(templateBaseDir) {
// https://stackoverflow.com/questions/31873396/is-it-possible-to-get-the-current-root-of-package-structure-as-a-string-in-golan