mirror of
https://github.com/mxpv/podsync.git
synced 2024-05-11 05:55:04 +00:00
Move HTTP server to services
This commit is contained in:
@@ -13,13 +13,13 @@ import (
|
||||
"github.com/mxpv/podsync/pkg/db"
|
||||
"github.com/mxpv/podsync/pkg/feed"
|
||||
"github.com/mxpv/podsync/pkg/model"
|
||||
"github.com/mxpv/podsync/pkg/server"
|
||||
"github.com/mxpv/podsync/pkg/ytdl"
|
||||
"github.com/mxpv/podsync/services/web"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
// Server is the web server configuration
|
||||
Server server.Config `toml:"server"`
|
||||
Server web.Config `toml:"server"`
|
||||
// Log is the optional logging configuration
|
||||
Log Log `toml:"log"`
|
||||
// Database configuration
|
||||
|
||||
@@ -6,11 +6,11 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/mxpv/podsync/services/web"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/mxpv/podsync/pkg/model"
|
||||
"github.com/mxpv/podsync/pkg/server"
|
||||
)
|
||||
|
||||
func TestLoadConfig(t *testing.T) {
|
||||
@@ -174,7 +174,7 @@ data_dir = "/data"
|
||||
|
||||
func TestDefaultHostname(t *testing.T) {
|
||||
cfg := Config{
|
||||
Server: server.Config{},
|
||||
Server: web.Config{},
|
||||
}
|
||||
|
||||
t.Run("empty hostname", func(t *testing.T) {
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
|
||||
"github.com/jessevdk/go-flags"
|
||||
"github.com/mxpv/podsync/pkg/feed"
|
||||
"github.com/mxpv/podsync/pkg/server"
|
||||
"github.com/mxpv/podsync/services/web"
|
||||
"github.com/robfig/cron/v3"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"golang.org/x/sync/errgroup"
|
||||
@@ -180,7 +180,7 @@ func main() {
|
||||
})
|
||||
|
||||
// Run web server
|
||||
srv := server.New(cfg.Server, storage)
|
||||
srv := web.New(cfg.Server, storage)
|
||||
|
||||
group.Go(func() error {
|
||||
log.Infof("running listener at %s", srv.Addr)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package server
|
||||
package web
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
Reference in New Issue
Block a user