app

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	Config         *Config
	CircleToken    string
	VaultTokenFile string
	VaultClient    *vault.Client
	TFCloudToken   string
	EnableMetrics  bool
	Metrics        *Metrics
}

App is the main application struct

func NewApp

func NewApp(circleToken, vaultTokenFile, tfCloudToken string, config *Config, enableMetrics bool) *App

NewApp creates a new App from the given configuration options

func (*App) Run

func (a *App) Run() error

Run starts the application

type CircleCIConfig

type CircleCIConfig struct {
	Name          string   `mapstructure:"name"`
	VaultRole     *string  `mapstructure:"vault_role"`
	VaultPolicies []string `mapstructure:"vault_policies"`
}

CircleCIConfig represents a specific instance of a CircleCI project we want to update an environment variable for

type Config

type Config struct {
	CircleCI []CircleCIConfig `mapstructure:"circleci"`
	TFCloud  []TFCloudConfig  `mapstructure:"tfcloud"`
	// The address of the vault server to use when creating tokens
	VaultAddress string `mapstructure:"vault_address"`
	// The variable name to use when setting a vault token. Defaults to VAULT_ADDR
	TokenVariable string `mapstructure:"token_variable"`
	// If true, all tokens will be created with the orphan flag set to true
	OrphanTokens bool `mapstructure:"orphan_tokens"`
	// The TTL of the tokens that will be created. Defaults to 30 minutes
	TokenTTL time.Duration `mapstructure:"token_ttl"`
	// The interval at which the token will be refreshed. Defaults to 1 hour
	TokenRefreshInterval time.Duration `mapstructure:"token_refresh_interval"`
}

Config represents the configuration file

type Metrics added in v1.5.2

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

type TFCloudConfig added in v1.0.0

type TFCloudConfig struct {
	// Workspace is the ID of the workspace in tfcloud. Should begin with ws- and is required
	Workspace string `mapstructure:"workspace"`
	// Name is an optional field that can be used to identify a workspace
	Name string `mapstructure:"name"`
	// VaultRole is the vault role to use for the token in this workspace
	VaultRole *string `mapstructure:"vault_role"`
	// VaultPolicies is a list of policies that will be given to the token in this workspace
	VaultPolicies []string `mapstructure:"vault_policies"`
}

TFCloudConfig represents a specific instance of a TFCloud workspace we want to update an environment variable for

Jump to

Keyboard shortcuts

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