app

package
v1.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 25, 2024 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Module = fx.Module("app",

	fx.Provide(func(conn IAMClient) iam.IAMClient {
		return iam.NewIAMClient(conn)
	}),

	domain.Module,

	fx.Invoke(
		func(server httpServer.Server, d domain.Domain, env *env.Env,
			logr logging.Logger,
			sessionRepo kv.Repo[*common.AuthSession],
		) {
			a := server.Raw()

			a.Use(httpServer.NewReadSessionMiddleware(sessionRepo, constants.CookieName, constants.CacheSessionPrefix))

			a.Use("/ws", func(c *fiber.Ctx) error {
				if websocket.IsWebSocketUpgrade(c) {
					return c.Next()
				}
				return fiber.ErrUpgradeRequired
			})

			a.Use("/ws", func(c *fiber.Ctx) error {
				ctx := c.Context()

				return websocket.New(func(sockConn *websocket.Conn) {
					if err := d.HandleWebSocket(ctx, sockConn); err != nil {
						logr.Errorf(err, "while handling websocket for resource update")
					}
				})(c)
			})

			a.Get("/healthy", func(c *fiber.Ctx) error {
				return c.SendString("OK")
			})

			a.All("*", func(c *fiber.Ctx) error {
				return c.SendStatus(fiber.StatusNotFound)
			})
		},
	),
)

Functions

This section is empty.

Types

type AuthCacheClient

type AuthCacheClient kv.Client

type AuthClient

type AuthClient grpc.Client

type ContainerRegistryClient

type ContainerRegistryClient grpc.Client

type IAMClient

type IAMClient grpc.Client

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL