frontend

package
v0.0.0-...-fa6ae4b Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2021 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cmd = &cobra.Command{
	Use:   "frontend",
	Short: "Starts Frontend service",
	Long:  `Starts Frontend service.`,
	RunE: func(cmd *cobra.Command, args []string) error {
		dsn := fmt.Sprintf("user=%s password=%s host=%s port=%d dbname=%s sslmode=%s pool_max_conns=%d",
			pgUser, pgPass, pgHost, pgPort, pgDbname, pgSslmode, pgMaxConn)

		frontendConfig.FrontendHostPort = net.JoinHostPort(frontendHost, strconv.Itoa(frontendPort))
		frontendConfig.AuthSecrets = authSecrets
		frontendConfig.Email = emailConfig

		ctx, cancel := context.WithCancel(context.Background())
		defer cancel()

		logger := logging.NewLogger(logLevel, logDevelopment)
		defer logger.Sync()

		ctx = logging.WithLogger(ctx, logger)

		cache := cache.New(ctx, &cacheConfig)
		defer cache.Client.Close()

		storage := storage.New(ctx, storageConfig)

		db := database.New(ctx, dsn)
		defer db.Pool.Close()

		if err := db.Migrate(ctx); err != nil {
			return err
		}
		if err := db.IsSchemaUpToDate(ctx); err != nil {
			return err
		}

		tracer := tracing.Init("frontend", jprom.New().Namespace(metrics.NSOptions{Name: "frontend", Tags: nil}), logger)
		server := frontend.NewServer(logger, tracer, cache, db, storage, frontendConfig)
		return server.Run()
	},
}

Cmd runs frontend service.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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