mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-04 03:50:16 +08:00
🎨 Clean code https://github.com/siyuan-note/siyuan/pull/9720
This commit is contained in:
parent
f38c52292b
commit
63e65af27c
@ -163,7 +163,7 @@ func CheckAuth(c *gin.Context) {
|
|||||||
// 未设置访问授权码
|
// 未设置访问授权码
|
||||||
if "" == Conf.AccessAuthCode {
|
if "" == Conf.AccessAuthCode {
|
||||||
// Skip the empty access authorization code check https://github.com/siyuan-note/siyuan/issues/9709
|
// 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()
|
c.Next()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -47,17 +47,15 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
RUN_IN_CONTAINER = false // 是否运行在容器中
|
RunInContainer = false // 是否运行在容器中
|
||||||
SIYUAN_ACCESS_AUTH_CODE_BYPASS = false // 是否跳过空访问授权码检查
|
SiyuanAccessAuthCodeBypass = false // 是否跳过空访问授权码检查
|
||||||
)
|
)
|
||||||
|
|
||||||
func initEnvVars() {
|
func initEnvVars() {
|
||||||
|
RunInContainer = isRunningInDockerContainer()
|
||||||
var err error
|
var err error
|
||||||
|
if SiyuanAccessAuthCodeBypass, err = strconv.ParseBool(os.Getenv("SIYUAN_ACCESS_AUTH_CODE_BYPASS")); nil != err {
|
||||||
RUN_IN_CONTAINER = isRunningInDockerContainer()
|
SiyuanAccessAuthCodeBypass = false
|
||||||
|
|
||||||
if SIYUAN_ACCESS_AUTH_CODE_BYPASS, err = strconv.ParseBool(os.Getenv("SIYUAN_ACCESS_AUTH_CODE_BYPASS")); nil != err {
|
|
||||||
SIYUAN_ACCESS_AUTH_CODE_BYPASS = false
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,13 +93,13 @@ func Boot() {
|
|||||||
ReadOnly, _ = strconv.ParseBool(*readOnly)
|
ReadOnly, _ = strconv.ParseBool(*readOnly)
|
||||||
AccessAuthCode = *accessAuthCode
|
AccessAuthCode = *accessAuthCode
|
||||||
Container = ContainerStd
|
Container = ContainerStd
|
||||||
if RUN_IN_CONTAINER {
|
if RunInContainer {
|
||||||
Container = ContainerDocker
|
Container = ContainerDocker
|
||||||
if "" == AccessAuthCode {
|
if "" == AccessAuthCode {
|
||||||
interruptBoot := true
|
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
|
// 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
|
interruptBoot = false
|
||||||
fmt.Println("bypass access auth code check since the env [SIYUAN_ACCESS_AUTH_CODE_BYPASS] is set to [true]")
|
fmt.Println("bypass access auth code check since the env [SIYUAN_ACCESS_AUTH_CODE_BYPASS] is set to [true]")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user