fix: rename root_secret -> admin_secret
This commit is contained in:
parent
2cda3ca8f4
commit
87bfb821d6
|
@ -1,7 +1,7 @@
|
|||
package constants
|
||||
|
||||
var (
|
||||
ROOT_SECRET = ""
|
||||
ADMIN_SECRET = ""
|
||||
ENV = ""
|
||||
VERSION = ""
|
||||
DATABASE_TYPE = ""
|
||||
|
|
|
@ -41,7 +41,7 @@ func InitEnv() {
|
|||
|
||||
constants.VERSION = Version
|
||||
|
||||
constants.ROOT_SECRET = os.Getenv("ROOT_SECRET")
|
||||
constants.ADMIN_SECRET = os.Getenv("ADMIN_SECRET")
|
||||
constants.ENV = os.Getenv("ENV")
|
||||
constants.DATABASE_TYPE = os.Getenv("DATABASE_TYPE")
|
||||
constants.DATABASE_URL = os.Getenv("DATABASE_URL")
|
||||
|
@ -69,7 +69,7 @@ func InitEnv() {
|
|||
constants.DISABLE_BASIC_AUTHENTICATION = os.Getenv("DISABLE_BASIC_AUTHENTICATION")
|
||||
constants.DISABLE_EMAIL_VERICATION = os.Getenv("DISABLE_EMAIL_VERICATION")
|
||||
|
||||
if constants.ROOT_SECRET == "" {
|
||||
if constants.ADMIN_SECRET == "" {
|
||||
panic("root admin secret is required")
|
||||
}
|
||||
|
||||
|
|
|
@ -6,10 +6,10 @@ import (
|
|||
)
|
||||
|
||||
func IsSuperAdmin(gc *gin.Context) bool {
|
||||
secret := gc.Request.Header.Get("x-authorizer-root-secret")
|
||||
secret := gc.Request.Header.Get("x-authorizer-admin-secret")
|
||||
if secret == "" {
|
||||
return false
|
||||
}
|
||||
|
||||
return secret == constants.ROOT_SECRET
|
||||
return secret == constants.ADMIN_SECRET
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user