gs_conf

package
v1.2.0-rc Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvironmentPrefix  = "GS_ENVS_PREFIX"
	IncludeEnvPatterns = "INCLUDE_ENV_PATTERNS"
	ExcludeEnvPatterns = "EXCLUDE_ENV_PATTERNS"
)
View Source
const CommandArgsPrefix = "GS_ARGS_PREFIX"

CommandArgsPrefix defines the environment variable name used to override the default option prefix.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppConfig

type AppConfig struct {
	LocalFile   *PropertySources
	RemoteFile  *PropertySources
	RemoteProp  gs.Properties
	Environment *Environment
	CommandArgs *CommandArgs
}

AppConfig is a layered app configuration.

func NewAppConfig

func NewAppConfig() *AppConfig

func (*AppConfig) Refresh

func (c *AppConfig) Refresh() (gs.Properties, error)

Refresh merges all layers into a properties as read-only.

type BootConfig

type BootConfig struct {
	LocalFile   *PropertySources
	Environment *Environment
	CommandArgs *CommandArgs
}

BootConfig is a layered boot configuration.

func NewBootConfig

func NewBootConfig() *BootConfig

func (*BootConfig) Refresh

func (c *BootConfig) Refresh() (gs.Properties, error)

Refresh merges all layers into a properties as read-only.

type CommandArgs

type CommandArgs struct{}

CommandArgs represents a structure for handling command-line parameters.

func NewCommandArgs

func NewCommandArgs() *CommandArgs

NewCommandArgs creates and returns a new CommandArgs instance.

func (*CommandArgs) CopyTo

func (c *CommandArgs) CopyTo(out *conf.Properties) error

CopyTo processes command-line parameters and sets them as key-value pairs in the provided conf.Properties. Parameters should be passed in the form of `-D key[=value/true]`.

type ConfigType

type ConfigType string
const (
	ConfigTypeLocal  ConfigType = "local"
	ConfigTypeRemote ConfigType = "remote"
)

type Environment

type Environment struct{}

Environment environment variable

func NewEnvironment

func NewEnvironment() *Environment

func (*Environment) CopyTo

func (c *Environment) CopyTo(p *conf.Properties) error

CopyTo add environment variables that matches IncludeEnvPatterns and exclude environment variables that matches ExcludeEnvPatterns.

type PropertySources

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

PropertySources is a collection of locations.

func NewPropertySources

func NewPropertySources(configType ConfigType, configName string) *PropertySources

func (*PropertySources) AddLocation

func (p *PropertySources) AddLocation(location ...string)

AddLocation adds a location.

func (*PropertySources) Reset

func (p *PropertySources) Reset()

Reset resets the locations.

Jump to

Keyboard shortcuts

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