Begin refactor to better encapsulate configuration

This also updates the example_config.json which did not previously work.
Config.Config is now composed of embedded structs of other configs that
can later be used to clearly have a separation of concerns.
This commit is contained in:
Jimmy Zelinskie
2014-11-01 20:12:40 -04:00
parent d754b5b376
commit ddd10d9732
5 changed files with 69 additions and 84 deletions
+1 -1
View File
@@ -35,7 +35,7 @@ type Storage struct {
func NewStorage(cfg *config.Config) *Storage {
s := &Storage{
users: make(map[string]*models.User),
shards: make([]Torrents, cfg.ShardConfig.TorrentMapShards),
shards: make([]Torrents, cfg.TorrentMapShards),
clients: make(map[string]bool),
}
for i := range s.shards {
+1 -1
View File
@@ -27,7 +27,7 @@ type Tracker struct {
// New creates a new Tracker, and opens any necessary connections.
// Maintenance routines are automatically spawned in the background.
func New(cfg *config.Config) (*Tracker, error) {
bc, err := backend.Open(&cfg.Backend)
bc, err := backend.Open(&cfg.DriverConfig)
if err != nil {
return nil, err
}