|
@@ -46,6 +46,21 @@ const (
|
|
IsInsider = false
|
|
IsInsider = false
|
|
)
|
|
)
|
|
|
|
|
|
|
|
+var (
|
|
|
|
+ RUN_IN_CONTAINER = false // 是否运行在容器中
|
|
|
|
+ SIYUAN_ACCESS_AUTH_CODE_BYPASS = false // 是否跳过空访问授权码检查
|
|
|
|
+)
|
|
|
|
+
|
|
|
|
+func initEnvVars() {
|
|
|
|
+ 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
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
var (
|
|
var (
|
|
bootProgress float64 // 启动进度,从 0 到 100
|
|
bootProgress float64 // 启动进度,从 0 到 100
|
|
bootDetails string // 启动细节描述
|
|
bootDetails string // 启动细节描述
|
|
@@ -53,6 +68,7 @@ var (
|
|
)
|
|
)
|
|
|
|
|
|
func Boot() {
|
|
func Boot() {
|
|
|
|
+ initEnvVars()
|
|
IncBootProgress(3, "Booting kernel...")
|
|
IncBootProgress(3, "Booting kernel...")
|
|
rand.Seed(time.Now().UTC().UnixNano())
|
|
rand.Seed(time.Now().UTC().UnixNano())
|
|
initMime()
|
|
initMime()
|
|
@@ -79,15 +95,13 @@ func Boot() {
|
|
ReadOnly, _ = strconv.ParseBool(*readOnly)
|
|
ReadOnly, _ = strconv.ParseBool(*readOnly)
|
|
AccessAuthCode = *accessAuthCode
|
|
AccessAuthCode = *accessAuthCode
|
|
Container = ContainerStd
|
|
Container = ContainerStd
|
|
- if isRunningInDockerContainer() {
|
|
|
|
|
|
+ if RUN_IN_CONTAINER {
|
|
Container = ContainerDocker
|
|
Container = ContainerDocker
|
|
if "" == AccessAuthCode {
|
|
if "" == AccessAuthCode {
|
|
interruptBoot := true
|
|
interruptBoot := true
|
|
|
|
|
|
- // Set the env `SIYUAN_ACCESS_AUTH_CODE_BYPASS=true` to skip checking access auth code when deploying Docker https://github.com/siyuan-note/siyuan/issues/9709
|
|
|
|
- byPassEnv := os.Getenv("SIYUAN_ACCESS_AUTH_CODE_BYPASS")
|
|
|
|
- bypass, parseErr := strconv.ParseBool(byPassEnv)
|
|
|
|
- if nil == parseErr && bypass {
|
|
|
|
|
|
+ // 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 {
|
|
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]")
|
|
}
|
|
}
|