mirror of
https://forgejo.merr.is/annika/isl-api.git
synced 2025-12-11 11:12:06 -05:00
Cleaned Up Logging And Variables
This commit is contained in:
parent
b5ea01729b
commit
f483833260
1 changed files with 2 additions and 6 deletions
8
main.go
8
main.go
|
|
@ -3,7 +3,6 @@ package main
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
|
||||||
"log/slog"
|
"log/slog"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
|
@ -18,7 +17,6 @@ import (
|
||||||
"github.com/go-chi/cors"
|
"github.com/go-chi/cors"
|
||||||
"github.com/go-chi/httplog/v2"
|
"github.com/go-chi/httplog/v2"
|
||||||
"github.com/jackc/pgx/v4/pgxpool"
|
"github.com/jackc/pgx/v4/pgxpool"
|
||||||
"github.com/lestrrat-go/jwx/v2/jwk"
|
|
||||||
"github.com/lmittmann/tint"
|
"github.com/lmittmann/tint"
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
)
|
)
|
||||||
|
|
@ -48,9 +46,9 @@ func main() {
|
||||||
deps := dependencies{}
|
deps := dependencies{}
|
||||||
deps.initializeDependencies()
|
deps.initializeDependencies()
|
||||||
|
|
||||||
fmt.Printf("Preparing to listen on `:%v`\n", conf.HttpPort)
|
logger.Info(fmt.Sprintf("Preparing to listen on `:%v`", conf.HttpPort))
|
||||||
err := http.ListenAndServe(fmt.Sprintf(":%v", conf.HttpPort), deps.router)
|
err := http.ListenAndServe(fmt.Sprintf(":%v", conf.HttpPort), deps.router)
|
||||||
log.Fatal(err)
|
logger.Error("Error starting server", "error", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
func setupConfig() {
|
func setupConfig() {
|
||||||
|
|
@ -78,11 +76,9 @@ type dependencies struct {
|
||||||
router *chi.Mux
|
router *chi.Mux
|
||||||
postgresConnection *pgxpool.Pool
|
postgresConnection *pgxpool.Pool
|
||||||
context context.Context
|
context context.Context
|
||||||
jwkContext context.Context
|
|
||||||
powerItemQuerier *powerItem.DBQuerier
|
powerItemQuerier *powerItem.DBQuerier
|
||||||
powerItemService *services.PowerItemService
|
powerItemService *services.PowerItemService
|
||||||
powerItemController *controllers.PowerItemController
|
powerItemController *controllers.PowerItemController
|
||||||
jwkCache *jwk.Cache
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *dependencies) initializeDependencies() error {
|
func (d *dependencies) initializeDependencies() error {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue