diff --git a/api/model.go b/api/model.go index 3606a6871835c6553d7c90401077abf232762746..54573b81780fb85a35a2acdb9e800b66e09e5183 100644 --- a/api/model.go +++ b/api/model.go @@ -190,11 +190,7 @@ func (u *User) NewAuthKey() *AuthKey { Secret: hex.EncodeToString(b), User: u.Email, } - if u.AuthKeyIds == nil { - u.AuthKeyIds = []string{key.KeyId} - } else { - u.AuthKeyIds = append(u.AuthKeyIds, key.KeyId) - } + u.AuthKeyIds = append(u.AuthKeyIds, key.KeyId) return key } diff --git a/client/djplay/djplay.go b/client/djplay/djplay.go index 02f258441e24ffc61cbabe8fade15f1a20b9937f..1567fdcd32abcec818c7b6e0b845ea347bb43eab 100644 --- a/client/djplay/djplay.go +++ b/client/djplay/djplay.go @@ -291,12 +291,11 @@ func main() { } authKey := &api.AuthKey{ - KeyId: config.MustString("auth_key", *authKeyId), - Secret: config.MustString("auth_secret", *authKeySecret), + KeyId: *authKeyId, + Secret: *authKeySecret, } - url := config.MustString("server_url", *serverUrl) certPool := client.LoadCA() - client := util.NewHttpClient(url, authKey, certPool) + client := util.NewHttpClient(*serverUrl, authKey, certPool) results := search(client, query) if *fill > 0 { diff --git a/partition/service.go b/partition/service.go index d374a60b9f775a0e7c1da228eebac56a8c8f931c..ce727b52285b62d22b56c88fd17b20d1c512c267 100644 --- a/partition/service.go +++ b/partition/service.go @@ -46,7 +46,7 @@ type PartitionedService interface { GetPartitionCounters() map[string]int SetPartitionCounters(map[string]int) GetSelfTarget() string - Scan() chan string + Scan() <-chan string Move(key string) error } diff --git a/services/index/service.go b/services/index/service.go index 3057ba05dcafb98e575c4485de41e3302a02a135..ff7b0261c1e59d72d947de15f1d5346ca74f0a36 100644 --- a/services/index/service.go +++ b/services/index/service.go @@ -72,7 +72,7 @@ func (is *IndexService) Stop() { is.quit <- true } -func (is *IndexService) Scan() chan string { +func (is *IndexService) Scan() <-chan string { ch := make(chan string) idCh := make(chan api.SongID) diff --git a/services/storage/service.go b/services/storage/service.go index 20747fcffed2d66a34760e986300a7a530d3eccd..c8ddc550694bce0dc9b33e858863af9c4e19355a 100644 --- a/services/storage/service.go +++ b/services/storage/service.go @@ -58,7 +58,7 @@ func NewStorageService(fsRoot string, authKey *api.AuthKey, pmap *partition.Part } } -func (ss *StorageService) Scan() chan string { +func (ss *StorageService) Scan() <-chan string { ch := make(chan string) go func() {