mirror of
https://github.com/sot-tech/mochi.git
synced 2026-07-02 06:48:57 -07:00
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:
+1
-1
@@ -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
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user