Settings: Rename constants/variables to follow Go naming standards (#28002)
* settings: Rename constants/variables to follow Go naming standards Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
This commit is contained in:
@@ -102,7 +102,7 @@ func (s *UserAuthTokenService) CreateToken(ctx context.Context, userId int64, cl
|
||||
|
||||
func (s *UserAuthTokenService) LookupToken(ctx context.Context, unhashedToken string) (*models.UserToken, error) {
|
||||
hashedToken := hashToken(unhashedToken)
|
||||
if setting.Env == setting.DEV {
|
||||
if setting.Env == setting.Dev {
|
||||
s.log.Debug("looking up token", "unhashed", unhashedToken, "hashed", hashedToken)
|
||||
}
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ func (rs *RenderingService) Init() error {
|
||||
// RendererCallbackUrl has already been passed, it won't generate an error.
|
||||
u, _ := url.Parse(rs.Cfg.RendererCallbackUrl)
|
||||
rs.domain = u.Hostname()
|
||||
case setting.HttpAddr != setting.DEFAULT_HTTP_ADDR:
|
||||
case setting.HttpAddr != setting.DefaultHTTPAddr:
|
||||
rs.domain = setting.HttpAddr
|
||||
default:
|
||||
rs.domain = "localhost"
|
||||
@@ -227,9 +227,9 @@ func (rs *RenderingService) getURL(path string) string {
|
||||
|
||||
protocol := setting.Protocol
|
||||
switch setting.Protocol {
|
||||
case setting.HTTP:
|
||||
case setting.HTTPScheme:
|
||||
protocol = "http"
|
||||
case setting.HTTP2, setting.HTTPS:
|
||||
case setting.HTTP2Scheme, setting.HTTPSScheme:
|
||||
protocol = "https"
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ func TestGetUrl(t *testing.T) {
|
||||
t.Run("And protocol HTTP configured should return expected path", func(t *testing.T) {
|
||||
rs.Cfg.ServeFromSubPath = false
|
||||
rs.Cfg.AppSubUrl = ""
|
||||
setting.Protocol = setting.HTTP
|
||||
setting.Protocol = setting.HTTPScheme
|
||||
url := rs.getURL(path)
|
||||
require.Equal(t, "http://localhost:3000/"+path+"&render=1", url)
|
||||
|
||||
@@ -43,7 +43,7 @@ func TestGetUrl(t *testing.T) {
|
||||
t.Run("And protocol HTTPS configured should return expected path", func(t *testing.T) {
|
||||
rs.Cfg.ServeFromSubPath = false
|
||||
rs.Cfg.AppSubUrl = ""
|
||||
setting.Protocol = setting.HTTPS
|
||||
setting.Protocol = setting.HTTPSScheme
|
||||
url := rs.getURL(path)
|
||||
require.Equal(t, "https://localhost:3000/"+path+"&render=1", url)
|
||||
})
|
||||
@@ -51,7 +51,7 @@ func TestGetUrl(t *testing.T) {
|
||||
t.Run("And protocol HTTP2 configured should return expected path", func(t *testing.T) {
|
||||
rs.Cfg.ServeFromSubPath = false
|
||||
rs.Cfg.AppSubUrl = ""
|
||||
setting.Protocol = setting.HTTP2
|
||||
setting.Protocol = setting.HTTP2Scheme
|
||||
url := rs.getURL(path)
|
||||
require.Equal(t, "https://localhost:3000/"+path+"&render=1", url)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user