Package template is responsible for rendering user supplied templates to
disk. The Server type accepts configuration to communicate to a Vault server
and a Vault token for authentication. Internally, the Server creates a Consul
Template Runner which manages reading secrets from Vault and rendering
templates to disk at configured locations
type Server struct {
// Templates holds the parsed Consul Templates Templates []*ctconfig.TemplateConfig DoneCh chan struct{}
// contains filtered or unexported fields
}
Server manages the Consul Template Runner which renders templates
Run kicks off the internal Consul Template runner, and listens for changes to
the token from the AuthHandler. If Done() is called on the context, shut down
the Runner and return
type ServerConfig struct {
Logger hclog.Logger// Client *api.Client AgentConfig *config.Config ExitAfterAuth bool Namespace string// LogLevel is needed to set the internal Consul Template Runner's log level// to match the log level of Vault Agent. The internal Runner creates it's own// logger and can't be set externally or copied from the Template Server.//// LogWriter is needed to initialize Consul Template's internal logger to use// the same io.Writer that Vault Agent itself is using. LogLevel hclog.Level LogWriter io.Writer}
ServerConfig is a config struct for setting up the basic parts of the
Server