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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user