Internal refactoring. Removing the global config.

This commit is contained in:
claudemiro
2016-03-06 15:34:12 -03:00
parent f07549fb6a
commit 1bae7f13ad
13 changed files with 347 additions and 254 deletions
+16 -2
View File
@@ -33,11 +33,25 @@ type app struct {
Stats *expvar.Map `json:"-"`
}
// Alloc memory for Connections and Channels
func (a *app) Init() {
func newApp(name, appID, key, secret string, onlySSL, disabled, userEvents, webHooks bool, webHookURL string) *app {
a := &app{
Name: name,
AppID: appID,
Key: key,
Secret: secret,
OnlySSL: onlySSL,
ApplicationDisabled: disabled,
UserEvents: userEvents,
WebHooks: webHooks,
URLWebHook: webHookURL,
}
a.Connections = make(map[string]*connection)
a.Channels = make(map[string]*channel)
a.Stats = expvar.NewMap(fmt.Sprintf("%s (%s)", a.Name, a.AppID))
return a
}
// Only Presence channels