|
|
@ -34,10 +34,10 @@ import ( |
|
|
|
type Scheme string |
|
|
|
type Scheme string |
|
|
|
|
|
|
|
|
|
|
|
const ( |
|
|
|
const ( |
|
|
|
HTTP Scheme = "http" |
|
|
|
SCHEME_HTTP Scheme = "http" |
|
|
|
HTTPS Scheme = "https" |
|
|
|
SCHEME_HTTPS Scheme = "https" |
|
|
|
FCGI Scheme = "fcgi" |
|
|
|
SCHEME_FCGI Scheme = "fcgi" |
|
|
|
UNIX_SOCKET Scheme = "unix" |
|
|
|
SCHEME_UNIX_SOCKET Scheme = "unix" |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
type LandingPage string |
|
|
|
type LandingPage string |
|
|
@ -74,6 +74,10 @@ var ( |
|
|
|
LandingPageURL LandingPage |
|
|
|
LandingPageURL LandingPage |
|
|
|
UnixSocketPermission uint32 |
|
|
|
UnixSocketPermission uint32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
HTTP struct { |
|
|
|
|
|
|
|
AccessControlAllowOrigin string |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
SSH struct { |
|
|
|
SSH struct { |
|
|
|
Disabled bool `ini:"DISABLE_SSH"` |
|
|
|
Disabled bool `ini:"DISABLE_SSH"` |
|
|
|
StartBuiltinServer bool `ini:"START_SSH_SERVER"` |
|
|
|
StartBuiltinServer bool `ini:"START_SSH_SERVER"` |
|
|
@ -388,15 +392,15 @@ func NewContext() { |
|
|
|
AppSubUrl = strings.TrimSuffix(url.Path, "/") |
|
|
|
AppSubUrl = strings.TrimSuffix(url.Path, "/") |
|
|
|
AppSubUrlDepth = strings.Count(AppSubUrl, "/") |
|
|
|
AppSubUrlDepth = strings.Count(AppSubUrl, "/") |
|
|
|
|
|
|
|
|
|
|
|
Protocol = HTTP |
|
|
|
Protocol = SCHEME_HTTP |
|
|
|
if sec.Key("PROTOCOL").String() == "https" { |
|
|
|
if sec.Key("PROTOCOL").String() == "https" { |
|
|
|
Protocol = HTTPS |
|
|
|
Protocol = SCHEME_HTTPS |
|
|
|
CertFile = sec.Key("CERT_FILE").String() |
|
|
|
CertFile = sec.Key("CERT_FILE").String() |
|
|
|
KeyFile = sec.Key("KEY_FILE").String() |
|
|
|
KeyFile = sec.Key("KEY_FILE").String() |
|
|
|
} else if sec.Key("PROTOCOL").String() == "fcgi" { |
|
|
|
} else if sec.Key("PROTOCOL").String() == "fcgi" { |
|
|
|
Protocol = FCGI |
|
|
|
Protocol = SCHEME_FCGI |
|
|
|
} else if sec.Key("PROTOCOL").String() == "unix" { |
|
|
|
} else if sec.Key("PROTOCOL").String() == "unix" { |
|
|
|
Protocol = UNIX_SOCKET |
|
|
|
Protocol = SCHEME_UNIX_SOCKET |
|
|
|
UnixSocketPermissionRaw := sec.Key("UNIX_SOCKET_PERMISSION").MustString("666") |
|
|
|
UnixSocketPermissionRaw := sec.Key("UNIX_SOCKET_PERMISSION").MustString("666") |
|
|
|
UnixSocketPermissionParsed, err := strconv.ParseUint(UnixSocketPermissionRaw, 8, 32) |
|
|
|
UnixSocketPermissionParsed, err := strconv.ParseUint(UnixSocketPermissionRaw, 8, 32) |
|
|
|
if err != nil || UnixSocketPermissionParsed > 0777 { |
|
|
|
if err != nil || UnixSocketPermissionParsed > 0777 { |
|
|
@ -557,7 +561,9 @@ func NewContext() { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if err = Cfg.Section("ui").MapTo(&UI); err != nil { |
|
|
|
if err = Cfg.Section("http").MapTo(&HTTP); err != nil { |
|
|
|
|
|
|
|
log.Fatal(4, "Fail to map HTTP settings: %v", err) |
|
|
|
|
|
|
|
} else if err = Cfg.Section("ui").MapTo(&UI); err != nil { |
|
|
|
log.Fatal(4, "Fail to map UI settings: %v", err) |
|
|
|
log.Fatal(4, "Fail to map UI settings: %v", err) |
|
|
|
} else if err = Cfg.Section("markdown").MapTo(&Markdown); err != nil { |
|
|
|
} else if err = Cfg.Section("markdown").MapTo(&Markdown); err != nil { |
|
|
|
log.Fatal(4, "Fail to map Markdown settings: %v", err) |
|
|
|
log.Fatal(4, "Fail to map Markdown settings: %v", err) |
|
|
|