Files
play-with-docker/api.go
2017-08-08 10:38:01 -03:00

35 lines
805 B
Go

package main
import (
"log"
"os"
"github.com/play-with-docker/play-with-docker/config"
"github.com/play-with-docker/play-with-docker/docker"
"github.com/play-with-docker/play-with-docker/event"
"github.com/play-with-docker/play-with-docker/handlers"
"github.com/play-with-docker/play-with-docker/storage"
)
func main() {
config.ParseFlags()
handlers.Bootstrap(initStorage, initEvent, initFactory)
handlers.Register()
}
func initStorage() storage.StorageApi {
s, err := storage.NewFileStorage(config.SessionsFile)
if err != nil && !os.IsNotExist(err) {
log.Fatal("Error initializing StorageAPI: ", err)
}
return s
}
func initEvent() event.EventApi {
return event.NewLocalBroker()
}
func initFactory(s storage.StorageApi) docker.FactoryApi {
return docker.NewLocalCachedFactory(s)
}