bootstrap

package
v0.0.0-...-1082435 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2023 License: MIT Imports: 35 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BeDaemon

func BeDaemon(arg string)

BeDaemon turns the current process into a daemon process

func Bootstrap

func Bootstrap(serviceInfo *ServiceInfo) (*conf.Bootstrap, log.Logger, registry.Registrar)

Bootstrap App

func CreateGrpcClient

func CreateGrpcClient(ctx context.Context, r registry.Discovery, serviceName string, timeoutDuration *durationpb.Duration) grpc.ClientConnInterface

CreateGrpcClient creates a GRPC client

func CreateGrpcServer

func CreateGrpcServer(cfg *conf.Bootstrap, m ...middleware.Middleware) *microGrpc.Server

CreateGrpcServer Create GRPC server

func CreateHttpServer

func CreateHttpServer(cfg *conf.Bootstrap, m ...middleware.Middleware) *microHttp.Server

CreateHttpServer creates a HTTP server

func LoadBootstrapConfig

func LoadBootstrapConfig(configPath string) *conf.Bootstrap

LoadBootstrapConfig loader bootstrap configuration

func NewConfigProvider

func NewConfigProvider(configPath string) config.Config

NewConfigProvider creates a configuration

func NewConsulRegistry

func NewConsulRegistry(c *conf.Registry) *consulMicro.Registry

NewConsulRegistry creates a registry discovery client - Consul

func NewDiscovery

func NewDiscovery(cfg *conf.Registry) registry.Discovery

NewDiscovery creates a discovery client

func NewEtcdRegistry

func NewEtcdRegistry(c *conf.Registry) *etcdMicro.Registry

NewEtcdRegistry creates a registry discovery client - Etcd

func NewFileConfigSource

func NewFileConfigSource(filePath string) config.Source

NewFileConfigSource creates a local file configuration source

func NewFluentLogger

func NewFluentLogger(cfg *conf.Logger) log.Logger

NewFluentLogger creates a new logger - Fluent

func NewJaegerExporter

func NewJaegerExporter(endpoint string) (traceSdk.SpanExporter, error)

NewJaegerExporter creates a jaeger exporter

func NewLogger

func NewLogger(cfg *conf.Logger) log.Logger

NewLogger creates a new logger

func NewLoggerProvider

func NewLoggerProvider(cfg *conf.Logger, serviceInfo *ServiceInfo) log.Logger

NewLoggerProvider creates a new logger provider

func NewRegistry

func NewRegistry(cfg *conf.Registry) registry.Registrar

NewRegistry creates new registry

func NewStdLogger

func NewStdLogger() log.Logger

NewStdLogger creates a new logger - Micro built-in, console output

func NewTracerExporter

func NewTracerExporter(exporterName, endpoint string) (traceSdk.SpanExporter, error)

NewTracerExporter creates an exporter that supports: jaeger and zipkin

func NewTracerProvider

func NewTracerProvider(cfg *conf.Tracer, serviceInfo *ServiceInfo) error

NewTracerProvider creates a link tracer

func NewZipkinExporter

func NewZipkinExporter(endpoint string) (traceSdk.SpanExporter, error)

NewZipkinExporter creates a zipkin exporter

Types

type CommandFlags

type CommandFlags struct {
	Conf       string
	Env        string
	ConfigHost string
	ConfigType string
	Daemon     bool
}

func NewCommandFlags

func NewCommandFlags() *CommandFlags

func (*CommandFlags) Init

func (f *CommandFlags) Init()

type ConfigType

type ConfigType string

type LoggerType

type LoggerType string
const (
	LoggerTypeStd    LoggerType = "std"
	LoggerTypeFluent LoggerType = "fluent"
)

type RegistryType

type RegistryType string
const (
	RegistryTypeConsul RegistryType = "consul"
	RegistryTypeEtcd   RegistryType = "etcd"
)

type ServiceInfo

type ServiceInfo struct {
	Name     string
	Version  string
	Id       string
	Metadata map[string]string
}

func NewServiceInfo

func NewServiceInfo(name, version, id string) *ServiceInfo

func (*ServiceInfo) GetInstanceId

func (s *ServiceInfo) GetInstanceId() string

func (*ServiceInfo) SetMataData

func (s *ServiceInfo) SetMataData(k, v string)

Jump to

Keyboard shortcuts

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