🎨 Clean code https://github.com/siyuan-note/siyuan/pull/9720
This commit is contained in:
parent
f38c52292b
commit
63e65af27c
2 changed files with 8 additions and 10 deletions
|
@ -163,7 +163,7 @@ func CheckAuth(c *gin.Context) {
|
|||
// 未设置访问授权码
|
||||
if "" == Conf.AccessAuthCode {
|
||||
// Skip the empty access authorization code check https://github.com/siyuan-note/siyuan/issues/9709
|
||||
if util.SIYUAN_ACCESS_AUTH_CODE_BYPASS {
|
||||
if util.SiyuanAccessAuthCodeBypass {
|
||||
c.Next()
|
||||
return
|
||||
}
|
||||
|
|
|
@ -47,17 +47,15 @@ const (
|
|||
)
|
||||
|
||||
var (
|
||||
RUN_IN_CONTAINER = false // 是否运行在容器中
|
||||
SIYUAN_ACCESS_AUTH_CODE_BYPASS = false // 是否跳过空访问授权码检查
|
||||
RunInContainer = false // 是否运行在容器中
|
||||
SiyuanAccessAuthCodeBypass = false // 是否跳过空访问授权码检查
|
||||
)
|
||||
|
||||
func initEnvVars() {
|
||||
RunInContainer = isRunningInDockerContainer()
|
||||
var err error
|
||||
|
||||
RUN_IN_CONTAINER = isRunningInDockerContainer()
|
||||
|
||||
if SIYUAN_ACCESS_AUTH_CODE_BYPASS, err = strconv.ParseBool(os.Getenv("SIYUAN_ACCESS_AUTH_CODE_BYPASS")); nil != err {
|
||||
SIYUAN_ACCESS_AUTH_CODE_BYPASS = false
|
||||
if SiyuanAccessAuthCodeBypass, err = strconv.ParseBool(os.Getenv("SIYUAN_ACCESS_AUTH_CODE_BYPASS")); nil != err {
|
||||
SiyuanAccessAuthCodeBypass = false
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -95,13 +93,13 @@ func Boot() {
|
|||
ReadOnly, _ = strconv.ParseBool(*readOnly)
|
||||
AccessAuthCode = *accessAuthCode
|
||||
Container = ContainerStd
|
||||
if RUN_IN_CONTAINER {
|
||||
if RunInContainer {
|
||||
Container = ContainerDocker
|
||||
if "" == AccessAuthCode {
|
||||
interruptBoot := true
|
||||
|
||||
// Set the env `SIYUAN_ACCESS_AUTH_CODE_BYPASS=true` to skip checking empty access auth code https://github.com/siyuan-note/siyuan/issues/9709
|
||||
if SIYUAN_ACCESS_AUTH_CODE_BYPASS {
|
||||
if SiyuanAccessAuthCodeBypass {
|
||||
interruptBoot = false
|
||||
fmt.Println("bypass access auth code check since the env [SIYUAN_ACCESS_AUTH_CODE_BYPASS] is set to [true]")
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue