Chore: Remove public vars in setting package (#81018)

Removes the public variable setting.SecretKey plus some other ones. 
Introduces some new functions for creating setting.Cfg.
This commit is contained in:
Marcus Efraimsson
2024-01-23 12:36:22 +01:00
committed by GitHub
parent 147bf01745
commit 6768c6c059
131 changed files with 759 additions and 699 deletions
+3 -3
View File
@@ -76,7 +76,7 @@ func TestTimeLimitCodes(t *testing.T) {
for _, test := range tests {
t.Run(test.desc, func(t *testing.T) {
code, err := createTimeLimitCode(test.payload, test.minutes, test.start.Format(format))
code, err := createTimeLimitCode(cfg.SecretKey, test.payload, test.minutes, test.start.Format(format))
require.NoError(t, err)
isValid, err := validateUserEmailCode(cfg, user, code)
@@ -86,7 +86,7 @@ func TestTimeLimitCodes(t *testing.T) {
}
t.Run("tampered minutes", func(t *testing.T) {
code, err := createTimeLimitCode(mailPayload, 5, tenMinutesAgo.Format(format))
code, err := createTimeLimitCode(cfg.SecretKey, mailPayload, 5, tenMinutesAgo.Format(format))
require.NoError(t, err)
// code is expired
@@ -102,7 +102,7 @@ func TestTimeLimitCodes(t *testing.T) {
})
t.Run("tampered start string", func(t *testing.T) {
code, err := createTimeLimitCode(mailPayload, 5, tenMinutesAgo.Format(format))
code, err := createTimeLimitCode(cfg.SecretKey, mailPayload, 5, tenMinutesAgo.Format(format))
require.NoError(t, err)
// code is expired