Move init of channels closer to init

This commit is contained in:
Peter Stuifzand 2018-10-03 18:48:49 +02:00
parent 08257bab25
commit c51bfc4603
Signed by: peter
GPG Key ID: 374322D56E5209E8

View File

@ -154,15 +154,17 @@ func createMemoryBackend() microsub.Microsub {
backend := memoryBackend{} backend := memoryBackend{}
backend.lock.Lock() backend.lock.Lock()
backend.Channels = make(map[string]microsub.Channel)
backend.Feeds = make(map[string][]microsub.Feed) backend.Feeds = make(map[string][]microsub.Feed)
channels := []microsub.Channel{ channels := []microsub.Channel{
{UID: "notifications", Name: "Notifications"}, {UID: "notifications", Name: "Notifications"},
{UID: "home", Name: "Home"}, {UID: "home", Name: "Home"},
} }
backend.Channels = make(map[string]microsub.Channel)
for _, c := range channels { for _, c := range channels {
backend.Channels[c.UID] = c backend.Channels[c.UID] = c
} }
backend.NextUid = 1000000 backend.NextUid = 1000000
backend.Me = "https://example.com/" backend.Me = "https://example.com/"