|
|
@ -2,6 +2,7 @@ package config |
|
|
|
|
|
|
|
|
|
|
|
import ( |
|
|
|
import ( |
|
|
|
"encoding/json" |
|
|
|
"encoding/json" |
|
|
|
|
|
|
|
"io" |
|
|
|
"os" |
|
|
|
"os" |
|
|
|
"path" |
|
|
|
"path" |
|
|
|
"sync" |
|
|
|
"sync" |
|
|
@ -107,7 +108,13 @@ func (c *Config) ReadConfig() error { |
|
|
|
users := make(map[string]User) |
|
|
|
users := make(map[string]User) |
|
|
|
decoder := json.NewDecoder(file) |
|
|
|
decoder := json.NewDecoder(file) |
|
|
|
err = decoder.Decode(&users) |
|
|
|
err = decoder.Decode(&users) |
|
|
|
if err != nil { |
|
|
|
switch err { |
|
|
|
|
|
|
|
case io.EOF: |
|
|
|
|
|
|
|
return nil |
|
|
|
|
|
|
|
case nil: |
|
|
|
|
|
|
|
c.Users = users |
|
|
|
|
|
|
|
return nil |
|
|
|
|
|
|
|
default: |
|
|
|
return err |
|
|
|
return err |
|
|
|
} |
|
|
|
} |
|
|
|
c.Users = users |
|
|
|
c.Users = users |
|
|
|