endpoint

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2023 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsHelpOption

func IsHelpOption(args []string) bool

IsHelpOption returns true if helper

func NewConfigHandler

func NewConfigHandler(config *Config) http.Handler

NewConfigHandler creates a config handler

func NewHealthHandler added in v0.3.0

func NewHealthHandler(config *Config) *healthHandler

func RunApp

func RunApp(Version string, args []string, wg *sync.WaitGroup)

RunApp run application

func RunAppWithConfig

func RunAppWithConfig(Version string, args []string, configProvider func(options *Options) (*Config, error))

RunAppWithConfig run application

Types

type Config

type Config struct {
	config.ModelList      `json:",omitempty" yaml:",inline"`
	sconfig.DatastoreList `json:",omitempty" yaml:",inline"`
	Endpoint              econfig.Endpoint
	AllowedSubnet         []string `json:",omitempty" yaml:",omitempty"`
}

Config represents an endpoint config

func NewConfigFromURL

func NewConfigFromURL(ctx context.Context, URL string) (*Config, error)

NewConfigFromURL creates a new config from URL

func (*Config) Init

func (c *Config) Init()

Init initialise config

func (*Config) LoadFromURL

func (c *Config) LoadFromURL(ctx context.Context, URL string, target interface{}) error

func (*Config) Validate

func (c *Config) Validate() error

Validate validates config

type Options

type Options struct {
	ConfigURL string `short:"c" long:"cfg" description:"config URI"`
	Version   bool   `short:"v" long:"version" description:"indexer version"`
}

Options represents an option

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service represents http bridge

func New

func New(config *Config) (*Service, error)

New creates a bridge Service

func (*Service) ListenAndServe

func (s *Service) ListenAndServe() error

ListenAndServe start http endpoint

func (*Service) ListenAndServeTLS

func (s *Service) ListenAndServeTLS(certFile, keyFile string) error

ListenAndServeTLS start https endpoint on secure port

func (*Service) Metric

func (s *Service) Metric() *gmetric.Service

Metric returns operation metrics

func (*Service) Shutdown

func (s *Service) Shutdown(ctx context.Context) error

Shutdown stops server

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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