mirror of
https://github.com/mattermost/focalboard.git
synced 2024-12-24 13:43:12 +02:00
localOnly config flag
This commit is contained in:
parent
a144fe113d
commit
b4e52b4073
@ -6,5 +6,6 @@
|
|||||||
"useSSL": false,
|
"useSSL": false,
|
||||||
"webpath": "./pack",
|
"webpath": "./pack",
|
||||||
"filespath": "./files",
|
"filespath": "./files",
|
||||||
"telemetry": true
|
"telemetry": true,
|
||||||
|
"localOnly": true
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
"secret": "this-is-a-secret-string",
|
"secret": "this-is-a-secret-string",
|
||||||
"session_expire_time": 2592000,
|
"session_expire_time": 2592000,
|
||||||
"session_refresh_time": 18000,
|
"session_refresh_time": 18000,
|
||||||
|
"localOnly": false,
|
||||||
"enableLocalMode": true,
|
"enableLocalMode": true,
|
||||||
"localModeSocketLocation": "/var/tmp/octo_local.socket"
|
"localModeSocketLocation": "/var/tmp/octo_local.socket"
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,7 @@ func New(cfg *config.Configuration, singleUser bool) (*Server, error) {
|
|||||||
// Init workspace
|
// Init workspace
|
||||||
appBuilder().GetRootWorkspace()
|
appBuilder().GetRootWorkspace()
|
||||||
|
|
||||||
webServer := web.NewServer(cfg.WebPath, cfg.Port, cfg.UseSSL)
|
webServer := web.NewServer(cfg.WebPath, cfg.Port, cfg.UseSSL, cfg.LocalOnly)
|
||||||
webServer.AddRoutes(wsServer)
|
webServer.AddRoutes(wsServer)
|
||||||
webServer.AddRoutes(api)
|
webServer.AddRoutes(api)
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@ type Configuration struct {
|
|||||||
Secret string `json:"secret" mapstructure:"secret"`
|
Secret string `json:"secret" mapstructure:"secret"`
|
||||||
SessionExpireTime int64 `json:"session_expire_time" mapstructure:"session_expire_time"`
|
SessionExpireTime int64 `json:"session_expire_time" mapstructure:"session_expire_time"`
|
||||||
SessionRefreshTime int64 `json:"session_refresh_time" mapstructure:"session_refresh_time"`
|
SessionRefreshTime int64 `json:"session_refresh_time" mapstructure:"session_refresh_time"`
|
||||||
|
LocalOnly bool `json:"localonly" mapstructure:"localonly"`
|
||||||
EnableLocalMode bool `json:"enableLocalMode" mapstructure:"enableLocalMode"`
|
EnableLocalMode bool `json:"enableLocalMode" mapstructure:"enableLocalMode"`
|
||||||
LocalModeSocketLocation string `json:"localModeSocketLocation" mapstructure:"localModeSocketLocation"`
|
LocalModeSocketLocation string `json:"localModeSocketLocation" mapstructure:"localModeSocketLocation"`
|
||||||
}
|
}
|
||||||
@ -40,9 +41,11 @@ func ReadConfigFile() (*Configuration, error) {
|
|||||||
viper.SetDefault("DBConfigString", "./octo.db")
|
viper.SetDefault("DBConfigString", "./octo.db")
|
||||||
viper.SetDefault("WebPath", "./pack")
|
viper.SetDefault("WebPath", "./pack")
|
||||||
viper.SetDefault("FilesPath", "./files")
|
viper.SetDefault("FilesPath", "./files")
|
||||||
|
viper.SetDefault("Telemetry", true)
|
||||||
viper.SetDefault("WebhookUpdate", nil)
|
viper.SetDefault("WebhookUpdate", nil)
|
||||||
viper.SetDefault("SessionExpireTime", 60*60*24*30) // 30 days session lifetime
|
viper.SetDefault("SessionExpireTime", 60*60*24*30) // 30 days session lifetime
|
||||||
viper.SetDefault("SessionRefreshTime", 60*60*5) // 5 minutes session refresh
|
viper.SetDefault("SessionRefreshTime", 60*60*5) // 5 minutes session refresh
|
||||||
|
viper.SetDefault("LocalOnly", false)
|
||||||
viper.SetDefault("EnableLocalMode", false)
|
viper.SetDefault("EnableLocalMode", false)
|
||||||
viper.SetDefault("LocalModeSocketLocation", "/var/tmp/octo_local.socket")
|
viper.SetDefault("LocalModeSocketLocation", "/var/tmp/octo_local.socket")
|
||||||
|
|
||||||
|
@ -26,15 +26,23 @@ type Server struct {
|
|||||||
rootPath string
|
rootPath string
|
||||||
port int
|
port int
|
||||||
ssl bool
|
ssl bool
|
||||||
|
localOnly bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewServer creates a new instance of the webserver.
|
// NewServer creates a new instance of the webserver.
|
||||||
func NewServer(rootPath string, port int, ssl bool) *Server {
|
func NewServer(rootPath string, port int, ssl bool, localOnly bool) *Server {
|
||||||
r := mux.NewRouter()
|
r := mux.NewRouter()
|
||||||
|
|
||||||
|
var addr string
|
||||||
|
if localOnly {
|
||||||
|
addr = fmt.Sprintf(`localhost:%d`, port)
|
||||||
|
} else {
|
||||||
|
addr = fmt.Sprintf(`:%d`, port)
|
||||||
|
}
|
||||||
|
|
||||||
ws := &Server{
|
ws := &Server{
|
||||||
Server: http.Server{
|
Server: http.Server{
|
||||||
Addr: fmt.Sprintf(`:%d`, port),
|
Addr: addr,
|
||||||
Handler: r,
|
Handler: r,
|
||||||
},
|
},
|
||||||
rootPath: rootPath,
|
rootPath: rootPath,
|
||||||
|
Loading…
Reference in New Issue
Block a user