consulappconfig

package
v0.15.1 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PropertiesPrefix        = "cloud.consul.config"
	DefaultConfigPathPrefix = "userviceconfiguration"
	DefaultConfigPath       = "defaultapplication"
	DefaultProfileSeparator = ","
)

Variables

View Source
var Module = &bootstrap.Module{
	Name:       "bootstrap endpoint",
	Precedence: bootstrap.AppConfigPrecedence,
	PriorityOptions: []fx.Option{
		fx.Provide(
			bindConsulConfigProperties,
			fxNewConsulDefaultContextProviderGroup,
			fxNewConsulAppContextProviderGroup,
		),
	},
}

Functions

func NewProviderGroup

func NewProviderGroup(opts ...ProviderGroupOptions) appconfig.ProviderGroup

NewProviderGroup create a Consul KV store backed appconfig.ProviderGroup. The provider group is responsible to load application properties from Consul KV store at paths: <ProviderGroupOption.Prefix>/<ProviderGroupOption.Path>[<ProviderGroupOption.ProfileSeparator><any active profile>] e.g. - "userviceconfiguration/defaultapplication" - "userviceconfiguration/defaultapplication,prod" - "userviceconfiguration/my-service" - "userviceconfiguration/my-service,staging"

Types

type ConfigProvider

type ConfigProvider struct {
	appconfig.ProviderMeta
	// contains filtered or unexported fields
}

func NewConfigProvider

func NewConfigProvider(precedence int, contextPath string, conn *consul.Connection) *ConfigProvider

func (*ConfigProvider) Load

func (configProvider *ConfigProvider) Load(ctx context.Context) (loadError error)

func (*ConfigProvider) Name

func (configProvider *ConfigProvider) Name() string

type ConsulConfigProperties

type ConsulConfigProperties struct {
	Enabled          bool   `json:"enabled"`
	Prefix           string `json:"prefix"`
	DefaultContext   string `json:"default-context"`
	ProfileSeparator string `json:"profile-separator"`
}

type ProviderGroupOption

type ProviderGroupOption struct {
	Precedence       int
	Prefix           string
	Path             string
	ProfileSeparator string
	Connection       *consul.Connection
}

type ProviderGroupOptions

type ProviderGroupOptions func(opt *ProviderGroupOption)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳