feat: replace config system with viper based system
allows for config settings to be easily set through ENV variables, config files, or CLI flags adds flag to run migration on web server start (fixes #29)
This commit is contained in:
@ -16,17 +16,15 @@ import (
|
||||
"github.com/99designs/gqlgen/graphql/playground"
|
||||
"github.com/google/uuid"
|
||||
"github.com/jordanknott/taskcafe/internal/auth"
|
||||
"github.com/jordanknott/taskcafe/internal/config"
|
||||
"github.com/jordanknott/taskcafe/internal/db"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/vektah/gqlparser/v2/gqlerror"
|
||||
)
|
||||
|
||||
// NewHandler returns a new graphql endpoint handler.
|
||||
func NewHandler(config config.AppConfig, repo db.Repository) http.Handler {
|
||||
func NewHandler(repo db.Repository) http.Handler {
|
||||
c := Config{
|
||||
Resolvers: &Resolver{
|
||||
Config: config,
|
||||
Repository: repo,
|
||||
},
|
||||
}
|
||||
|
@ -5,12 +5,10 @@ package graph
|
||||
import (
|
||||
"sync"
|
||||
|
||||
"github.com/jordanknott/taskcafe/internal/config"
|
||||
"github.com/jordanknott/taskcafe/internal/db"
|
||||
)
|
||||
|
||||
type Resolver struct {
|
||||
Config config.AppConfig
|
||||
Repository db.Repository
|
||||
mu sync.Mutex
|
||||
}
|
||||
|
Reference in New Issue
Block a user