bootstrap

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package bootstrap implements the functions, types, and interfaces for the module.

Index

Constants

View Source
const (
	DefaultConfigPath = "configs/config.toml"
	DefaultEnv        = "dev"
	DefaultWorkDir    = "."
)

Constants for default paths and environment

Variables

View Source
var (
	// ErrNotFound defined error from kratos config package
	ErrNotFound = kratosconfig.ErrNotFound
)

Functions

func LoadSourceConfig

func LoadSourceConfig(bootstrap *Bootstrap) (*configv1.SourceConfig, error)

LoadSourceConfig loads the config file from the given path

Types

type Bootstrap

type Bootstrap struct {
	Flags      Flags
	WorkDir    string
	ConfigPath string
	Env        string
	Daemon     bool
}

Bootstrap struct to hold bootstrap information

func DefaultBootstrap

func DefaultBootstrap() *Bootstrap

DefaultBootstrap returns a default bootstrap

func New added in v0.0.5

func New(dir, path string) *Bootstrap

New returns a new bootstrap

func (*Bootstrap) ID added in v0.0.5

func (b *Bootstrap) ID() string

ID returns the ID

func (*Bootstrap) Metadata added in v0.0.5

func (b *Bootstrap) Metadata() map[string]string

Metadata returns the metadata

func (*Bootstrap) ServiceID added in v0.0.5

func (b *Bootstrap) ServiceID() string

ServiceID returns the service ID

func (*Bootstrap) ServiceName added in v0.0.5

func (b *Bootstrap) ServiceName() string

ServiceName returns the service name

func (*Bootstrap) SetFlags added in v0.0.5

func (b *Bootstrap) SetFlags(name, version string)

SetFlags sets the flags for the bootstrap

func (*Bootstrap) StartTime added in v0.0.5

func (b *Bootstrap) StartTime() time.Time

StartTime returns the start time

func (*Bootstrap) Version added in v0.0.5

func (b *Bootstrap) Version() string

Version returns the version

func (*Bootstrap) WorkPath added in v0.0.5

func (b *Bootstrap) WorkPath() string

WorkPath returns the work path

type Config added in v0.0.7

type Config = kratosconfig.Config

Define types from kratos config package

func NewConfig added in v0.0.7

func NewConfig(opts ...Option) Config

NewConfig returns a new config instance

type Decoder added in v0.0.7

type Decoder = kratosconfig.Decoder

Define types from kratos config package

type Flags

type Flags struct {
	ID          string
	Version     string
	ServiceName string
	StartTime   time.Time
	Metadata    map[string]string
}

Flags is a struct that holds the flags for the service

func DefaultFlags

func DefaultFlags() Flags

DefaultFlags returns the default flags for the service

func NewFlags

func NewFlags(name string, version string) Flags

NewFlags returns a new set of flags for the service

func (Flags) ServiceID

func (f Flags) ServiceID() string

ServiceID returns the ID of the service

type KeyValue added in v0.0.7

type KeyValue = kratosconfig.KeyValue

Define types from kratos config package

type Merge added in v0.0.7

type Merge = kratosconfig.Merge

Define types from kratos config package

type Observer added in v0.0.7

type Observer = kratosconfig.Observer

Define types from kratos config package

type Option added in v0.0.7

type Option = kratosconfig.Option

Define types from kratos config package

func WithDecoder added in v0.0.7

func WithDecoder(d Decoder) Option

WithDecoder sets the decoder

func WithMergeFunc added in v0.0.7

func WithMergeFunc(m Merge) Option

WithMergeFunc sets the merge function

func WithResolveActualTypes added in v0.0.7

func WithResolveActualTypes(enableConvertToType bool) Option

WithResolveActualTypes enables resolving actual types

func WithResolver added in v0.0.7

func WithResolver(r Resolver) Option

WithResolver sets the resolver

func WithSource added in v0.0.7

func WithSource(s ...Source) Option

WithSource sets the source

type Reader added in v0.0.7

type Reader = kratosconfig.Reader

Define types from kratos config package

type Resolver added in v0.0.7

type Resolver = kratosconfig.Resolver

Define types from kratos config package

type Source added in v0.0.7

type Source = kratosconfig.Source

Define types from kratos config package

type Value added in v0.0.7

type Value = kratosconfig.Value

Define types from kratos config package

type Watcher added in v0.0.7

type Watcher = kratosconfig.Watcher

Define types from kratos config package

Jump to

Keyboard shortcuts

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