1
0
mirror of https://github.com/mxpv/podsync.git synced 2024-05-11 05:55:04 +00:00

Code cleanup

This commit is contained in:
Maksym Pavlenko
2017-11-02 18:19:21 -07:00
parent 3c43f84cc0
commit aaa96f0f04
2 changed files with 5 additions and 9 deletions

View File

@@ -12,7 +12,6 @@ import (
"syscall" "syscall"
"github.com/GoogleCloudPlatform/cloudsql-proxy/proxy/proxy" "github.com/GoogleCloudPlatform/cloudsql-proxy/proxy/proxy"
"github.com/coreos/etcd/pkg/srv"
"github.com/go-pg/pg" "github.com/go-pg/pg"
"github.com/mxpv/podsync/pkg/api" "github.com/mxpv/podsync/pkg/api"
"github.com/mxpv/podsync/pkg/builders" "github.com/mxpv/podsync/pkg/builders"
@@ -49,11 +48,13 @@ func main() {
panic(err) panic(err)
} }
pg, err := createPg(cfg.PostgresConnectionURL) database, err := createPg(cfg.PostgresConnectionURL)
if err != nil { if err != nil {
panic(err) panic(err)
} }
patreon := support.NewPatreon(database)
// Builders // Builders
youtube, err := builders.NewYouTubeBuilder(cfg.YouTubeApiKey) youtube, err := builders.NewYouTubeBuilder(cfg.YouTubeApiKey)
@@ -73,8 +74,6 @@ func main() {
feeds.WithBuilder(api.Vimeo, vimeo), feeds.WithBuilder(api.Vimeo, vimeo),
) )
patreon := support.NewPatreon(pg)
srv := http.Server{ srv := http.Server{
Addr: fmt.Sprintf(":%d", 5001), Addr: fmt.Sprintf(":%d", 5001),
Handler: handler.New(feed, patreon, cfg), Handler: handler.New(feed, patreon, cfg),
@@ -92,7 +91,7 @@ func main() {
log.Printf("shutting down server") log.Printf("shutting down server")
srv.Shutdown(ctx) srv.Shutdown(ctx)
pg.Close() database.Close()
log.Printf("server gracefully stopped") log.Printf("server gracefully stopped")
} }

View File

@@ -28,11 +28,8 @@ type feedService interface {
GetMetadata(hashId string) (*api.Feed, error) GetMetadata(hashId string) (*api.Feed, error)
} }
// HACK: mockgen fails to import patreon.Pledge type
type P *patreon.Pledge
type patreonService interface { type patreonService interface {
Hook(pledge P, event string) error Hook(pledge *patreon.Pledge, event string) error
GetFeatureLevel(patronID string) int GetFeatureLevel(patronID string) int
} }