Skip to content

clean up redundant import aliasing #238

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/handler/card.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/labstack/echo/v4"
"github.com/pkg/errors"

service "github.com/String-xyz/string-api/pkg/service"
"github.com/String-xyz/string-api/pkg/service"
)

type Card interface {
Expand Down
15 changes: 7 additions & 8 deletions api/handler/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"time"

"github.com/String-xyz/go-lib/v2/common"
libcommon "github.com/String-xyz/go-lib/v2/common"
"github.com/String-xyz/go-lib/v2/httperror"
serror "github.com/String-xyz/go-lib/v2/stringerror"
"github.com/String-xyz/string-api/pkg/model"
Expand All @@ -23,8 +22,8 @@ func SetJWTCookie(c echo.Context, jwt model.JWT) error {
cookie.HttpOnly = true
cookie.Expires = jwt.ExpAt // we want the cookie to expire at the same time as the token
cookie.SameSite = getCookieSameSiteMode()
cookie.Path = "/" // Send cookie in every sub path request
cookie.Secure = !libcommon.IsLocalEnv() // in production allow https only
cookie.Path = "/" // Send cookie in every sub path request
cookie.Secure = !common.IsLocalEnv() // in production allow https only
c.SetCookie(cookie)

return nil
Expand All @@ -37,8 +36,8 @@ func SetRefreshTokenCookie(c echo.Context, refresh model.RefreshTokenResponse) e
cookie.HttpOnly = true
cookie.Expires = refresh.ExpAt // we want the cookie to expire at the same time as the token
cookie.SameSite = getCookieSameSiteMode()
cookie.Path = "/login/" // Send cookie only in /login path request
cookie.Secure = !libcommon.IsLocalEnv() // in production allow https only
cookie.Path = "/login/" // Send cookie only in /login path request
cookie.Secure = !common.IsLocalEnv() // in production allow https only
c.SetCookie(cookie)

return nil
Expand Down Expand Up @@ -67,7 +66,7 @@ func DeleteAuthCookies(c echo.Context) error {
cookie.Expires = time.Now()
cookie.SameSite = getCookieSameSiteMode()
cookie.Path = "/" // Send cookie in every sub path request
cookie.Secure = !libcommon.IsLocalEnv()
cookie.Secure = !common.IsLocalEnv()
c.SetCookie(cookie)

cookie = new(http.Cookie)
Expand All @@ -77,7 +76,7 @@ func DeleteAuthCookies(c echo.Context) error {
cookie.Expires = time.Now()
cookie.SameSite = getCookieSameSiteMode()
cookie.Path = "/login/" // Send cookie only in refresh path request
cookie.Secure = !libcommon.IsLocalEnv()
cookie.Secure = !common.IsLocalEnv()
c.SetCookie(cookie)

return nil
Expand All @@ -90,7 +89,7 @@ func validAddress(addr string) bool {

func getCookieSameSiteMode() http.SameSite {
sameSiteMode := http.SameSiteNoneMode // allow cors
if libcommon.IsLocalEnv() {
if common.IsLocalEnv() {
sameSiteMode = http.SameSiteLaxMode // because SameSiteNoneMode is not allowed in localhost we use lax mode
}
return sameSiteMode
Expand Down
6 changes: 2 additions & 4 deletions pkg/internal/persona/persona_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@ package persona

import (
"fmt"
"testing"

env "github.com/String-xyz/go-lib/v2/config"
"github.com/stretchr/testify/assert"

"github.com/String-xyz/string-api/config"
"github.com/stretchr/testify/assert"
"testing"
)

func init() {
Expand Down