cmd

package
v0.0.0-...-cd4cd64 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RootCmd = &cobra.Command{
	Use:   "idl-repository",
	Short: "idl-repository stores all sorts of idls",
	Long:  `long explanation here`,
	Run: func(cmd *cobra.Command, args []string) {
		settings := &repository.Settings{
			Port: *port,
		}

		storage, err := storage.NewFileStorage(*storageDiretory)
		if err != nil {
			panic(err)
		}
		server := repository.NewServer(settings, storage)

		ctx, cancel := context.WithCancel(context.Background())
		grp, ctx := errgroup.WithContext(ctx)

		grp.Go(server.Run(ctx))

		waiter := make(chan os.Signal, 1)
		signal.Notify(waiter, syscall.SIGINT, syscall.SIGTERM)
		select {
		case <-waiter:
		case <-ctx.Done():
		}
		cancel()
		if err := grp.Wait(); err != nil {
			panic(err)
		}
	},
}

Functions

func Execute

func Execute()

Types

This section is empty.

Jump to

Keyboard shortcuts

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