You've already forked top-wallpaper
update-deps (#1)
Reviewed-on: #1 Co-authored-by: Ron Rise <ron@siteworxpro.com> Co-committed-by: Ron Rise <ron@siteworxpro.com>
This commit was merged in pull request #1.
This commit is contained in:
16
main.go
16
main.go
@@ -2,17 +2,22 @@ package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/labstack/echo/v4/middleware"
|
||||
"github.com/labstack/gommon/log"
|
||||
tphttp "github.com/siteworxpro/top-wallpaper/http"
|
||||
"github.com/siteworxpro/top-wallpaper/reddit"
|
||||
"github.com/siteworxpro/top-wallpaper/redis"
|
||||
"net/http"
|
||||
"os"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type contextKey string
|
||||
|
||||
const ContextKeyLogger contextKey = "logger"
|
||||
|
||||
func main() {
|
||||
|
||||
ctx, fn := context.WithCancel(context.Background())
|
||||
@@ -22,7 +27,8 @@ func main() {
|
||||
|
||||
if err != nil {
|
||||
log.Error("Could not initialize Redis client: ", err)
|
||||
os.Exit(1)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
e := echo.New()
|
||||
@@ -55,7 +61,7 @@ func main() {
|
||||
}
|
||||
|
||||
ctx = redis.WithContext(ctx, rc)
|
||||
ctx = context.WithValue(ctx, "logger", e.Logger)
|
||||
ctx = context.WithValue(ctx, ContextKeyLogger, e.Logger)
|
||||
|
||||
go reddit.Fetch(ctx)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user