diff options
Diffstat (limited to 'internal/api/client/account')
-rw-r--r-- | internal/api/client/account/account_test.go | 5 | ||||
-rw-r--r-- | internal/api/client/account/accountcreate.go | 7 |
2 files changed, 4 insertions, 8 deletions
diff --git a/internal/api/client/account/account_test.go b/internal/api/client/account/account_test.go index d6bb5a5c0..f2114a0f8 100644 --- a/internal/api/client/account/account_test.go +++ b/internal/api/client/account/account_test.go @@ -8,7 +8,6 @@ import ( "codeberg.org/gruf/go-store/kv" "github.com/gin-gonic/gin" - "github.com/spf13/viper" "github.com/stretchr/testify/suite" "github.com/superseriousbusiness/gotosocial/internal/api/client/account" "github.com/superseriousbusiness/gotosocial/internal/concurrency" @@ -90,8 +89,8 @@ func (suite *AccountStandardTestSuite) newContext(recorder *httptest.ResponseRec ctx.Set(oauth.SessionAuthorizedApplication, suite.testApplications["application_1"]) ctx.Set(oauth.SessionAuthorizedUser, suite.testUsers["local_account_1"]) - protocol := viper.GetString(config.Keys.Protocol) - host := viper.GetString(config.Keys.Host) + protocol := config.GetProtocol() + host := config.GetHost() baseURI := fmt.Sprintf("%s://%s", protocol, host) requestURI := fmt.Sprintf("%s/%s", baseURI, requestPath) diff --git a/internal/api/client/account/accountcreate.go b/internal/api/client/account/accountcreate.go index ee9f508d7..35eb36216 100644 --- a/internal/api/client/account/accountcreate.go +++ b/internal/api/client/account/accountcreate.go @@ -24,7 +24,6 @@ import ( "net/http" "github.com/sirupsen/logrus" - "github.com/spf13/viper" "github.com/gin-gonic/gin" "github.com/superseriousbusiness/gotosocial/internal/api" @@ -123,9 +122,7 @@ func (m *Module) AccountCreatePOSTHandler(c *gin.Context) { // validateCreateAccount checks through all the necessary prerequisites for creating a new account, // according to the provided account create request. If the account isn't eligible, an error will be returned. func validateCreateAccount(form *model.AccountCreateRequest) error { - keys := config.Keys - - if !viper.GetBool(keys.AccountsRegistrationOpen) { + if !config.GetAccountsRegistrationOpen() { return errors.New("registration is not open for this server") } @@ -149,7 +146,7 @@ func validateCreateAccount(form *model.AccountCreateRequest) error { return err } - if err := validate.SignUpReason(form.Reason, viper.GetBool(keys.AccountsReasonRequired)); err != nil { + if err := validate.SignUpReason(form.Reason, config.GetAccountsReasonRequired()); err != nil { return err } |