Skip to content

Commit

Permalink
Prevent plugin from crashing if SiteURL is not set (mattermost-commun…
Browse files Browse the repository at this point in the history
…ity#677)

* Prevent plugin from crashing if SiteURL is not set

* Change default baseURL to be . instead of empty string

* Revert "Change default baseURL to be . instead of empty string"

This reverts commit cceb380.
  • Loading branch information
mgdelacroix authored Jul 7, 2021
1 parent 6e214eb commit 4328375
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions mattermost-plugin/server/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,13 @@ func (p *Plugin) OnActivate() error {
return fmt.Errorf("error initializing the DB: %v", err)
}

baseURL := ""
if mmconfig.ServiceSettings.SiteURL != nil {
baseURL = *mmconfig.ServiceSettings.SiteURL
}

cfg := &config.Configuration{
ServerRoot: *mmconfig.ServiceSettings.SiteURL + "/plugins/focalboard",
ServerRoot: baseURL + "/plugins/focalboard",
Port: -1,
DBType: *mmconfig.SqlSettings.DriverName,
DBConfigString: *mmconfig.SqlSettings.DataSource,
Expand Down Expand Up @@ -174,7 +179,7 @@ func defaultLoggingConfig() string {
"delim": " ",
"min_level_len": 5,
"min_msg_len": 40,
"enable_color": true
"enable_color": true
},
"levels": [
{"id": 5, "name": "debug"},
Expand Down

0 comments on commit 4328375

Please sign in to comment.