Documentation ¶
Overview ¶
Package bootstrap handles bootstrapping an agent's config from HCP. It must be a separate package from other HCP components because it has a dependency on agent/config while other components need to be imported and run within the server process in agent/consul and that would create a dependency cycle.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TestEndpoint ¶
func TestEndpoint() hcp.TestEndpoint
TestEndpoint returns an hcp.TestEndpoint to be used in an hcp.MockHCPServer.
Types ¶
type ConfigLoader ¶
type ConfigLoader func(source config.Source) (config.LoadResult, error)
func MaybeBootstrap ¶
func MaybeBootstrap(ctx context.Context, loader ConfigLoader, ui UI) (bool, ConfigLoader, error)
MaybeBootstrap will use the passed ConfigLoader to read the existing configuration, and if required attempt to bootstrap from HCP. It will retry until successful or a terminal error condition is found (e.g. permission denied). It must be passed a (CLI) UI implementation so it can deliver progress updates to the user, for example if it is waiting to retry for a long period.
type UI ¶
UI is a shim to allow the agent command to pass in it's mitchelh/cli.UI so we can output useful messages to the user during bootstrapping. For example if we have to retry several times to bootstrap we don't want the agent to just stall with no output which is the case if we just returned all intermediate warnings or errors.