config

package
v0.0.0-...-b264059 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2023 License: Apache-2.0 Imports: 9 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AWSConfig

type AWSConfig struct {
	AccessKey       string           `long:"aws-access-key" env:"AWS_ACCESS_KEY_ID" yaml:"access-key" description:"AWS account access key."`
	SecretAccessKey string           `` /* 126-byte string literal not displayed */
	SessionToken    string           `long:"aws-session-token" env:"AWS_SESSION_TOKEN" yaml:"session-token" description:"AWS session token."`
	DynamoDBTable   string           `long:"dynamodb-table" env:"AWS_DYNAMODB_TABLE" yaml:"dynamodb-table" description:"AWS DynamoDB table for locks."`
	S3              []S3BucketConfig `group:"S3 Options" yaml:"s3"`
	Endpoint        string           `long:"aws-endpoint" env:"AWS_ENDPOINT" yaml:"endpoint" description:"AWS endpoint."`
	Region          string           `long:"aws-region" env:"AWS_REGION" yaml:"region" description:"AWS region."`
	APPRoleArn      string           `long:"aws-role-arn" env:"APP_ROLE_ARN" yaml:"app-role-arn" description:"Role ARN to Assume."`
	ExternalID      string           `long:"aws-external-id" env:"AWS_EXTERNAL_ID" yaml:"external-id" description:"External ID to use when assuming role."`
}

AWSConfig stores the DynamoDB table and S3 Bucket configuration

type Config

type Config struct {
	Version bool `short:"V" long:"version" description:"Display version."`

	ConfigFilePath string `short:"c" long:"config-file" env:"CONFIG_FILE" description:"Config File path"`

	Provider ProviderConfig `group:"General Provider Options" yaml:"provider"`

	Log LogConfig `group:"Logging Options" yaml:"log"`

	DB DBConfig `group:"Database Options" yaml:"database"`

	AWS []AWSConfig `group:"AWS Options" yaml:"aws"`

	TFE []TFEConfig `group:"Terraform Enterprise Options" yaml:"tfe"`

	GCP []GCPConfig `group:"Google Cloud Platform Options" yaml:"gcp"`

	Gitlab []GitlabConfig `group:"GitLab Options" yaml:"gitlab"`

	Web WebConfig `group:"Web" yaml:"web"`
}

Config stores the handler's configuration and UI interface parameters

func LoadConfig

func LoadConfig(version string) *Config

LoadConfig loads the config from flags & environment

func (*Config) LoadConfigFromYaml

func (c *Config) LoadConfigFromYaml(filename string) *Config

LoadConfigFromYaml loads the config from config file

func (Config) SetupLogging

func (c Config) SetupLogging() (err error)

SetupLogging sets up logging for Terraboard

func (*Config) UnmarshalYAML

func (s *Config) UnmarshalYAML(unmarshal func(interface{}) error) error

type DBConfig

type DBConfig struct {
	Host         string `long:"db-host" env:"DB_HOST" yaml:"host" description:"Database host." default:"db"`
	Port         uint16 `long:"db-port" env:"DB_PORT" yaml:"port" description:"Database port." default:"5432"`
	User         string `long:"db-user" env:"DB_USER" yaml:"user" description:"Database user." default:"gorm"`
	Password     string `long:"db-password" env:"DB_PASSWORD" yaml:"password" description:"Database password."`
	Name         string `long:"db-name" env:"DB_NAME" yaml:"name" description:"Database name." default:"gorm"`
	SSLMode      string `long:"db-sslmode" env:"DB_SSLMODE" yaml:"sslmode" description:"Database SSL mode." default:"require"`
	NoSync       bool   `long:"no-sync" yaml:"no-sync" description:"Do not sync database."`
	SyncInterval uint16 `long:"sync-interval" yaml:"sync-interval" description:"DB sync interval (in minutes)" default:"1"`
}

DBConfig stores the database configuration

type GCPConfig

type GCPConfig struct {
	HTTPClient *http.Client
	GCSBuckets []string `long:"gcs-bucket" yaml:"gcs-bucket" description:"Google Cloud bucket to search"`
	GCPSAKey   string   `` /* 156-byte string literal not displayed */
}

GCPConfig stores the Google Cloud configuration

type GitlabConfig

type GitlabConfig struct {
	Address string `long:"gitlab-address" env:"GITLAB_ADDRESS" yaml:"address" description:"GitLab address (root)" default:"https://gitlab.com"`
	Token   string `long:"gitlab-token" env:"GITLAB_TOKEN" yaml:"token" description:"Token to authenticate upon GitLab"`
}

GitlabConfig stores the GitLab configuration

func (*GitlabConfig) UnmarshalYAML

func (s *GitlabConfig) UnmarshalYAML(unmarshal func(interface{}) error) error

type LogConfig

type LogConfig struct {
	Level  string `` /* 163-byte string literal not displayed */
	Format string `long:"log-format" yaml:"format" env:"TERRABOARD_LOG_FORMAT" description:"Set log format ('plain', 'json')." default:"plain"`
}

LogConfig stores the log configuration

type ProviderConfig

type ProviderConfig struct {
	NoVersioning bool `` /* 177-byte string literal not displayed */
	NoLocks      bool `` /* 157-byte string literal not displayed */
}

ProviderConfig stores genral provider parameters

type S3BucketConfig

type S3BucketConfig struct {
	Bucket         string   `long:"s3-bucket" env:"AWS_BUCKET" yaml:"bucket" description:"AWS S3 bucket."`
	KeyPrefix      string   `long:"key-prefix" env:"AWS_KEY_PREFIX" yaml:"key-prefix" description:"AWS Key Prefix."`
	FileExtension  []string `` /* 149-byte string literal not displayed */
	ForcePathStyle bool     `long:"force-path-style" env:"AWS_FORCE_PATH_STYLE" yaml:"force-path-style" description:"Force path style S3 bucket calls."`
}

S3BucketConfig stores the S3 bucket configuration

func (*S3BucketConfig) UnmarshalYAML

func (s *S3BucketConfig) UnmarshalYAML(unmarshal func(interface{}) error) error

type TFEConfig

type TFEConfig struct {
	Address      string `long:"tfe-address" env:"TFE_ADDRESS" yaml:"address" description:"Terraform Enterprise address for states access"`
	Token        string `long:"tfe-token" env:"TFE_TOKEN" yaml:"token" description:"Terraform Enterprise Token for states access"`
	Organization string `` /* 132-byte string literal not displayed */
}

TFEConfig stores the Terraform Enterprise configuration

type WebConfig

type WebConfig struct {
	Port        uint16 `short:"p" long:"port" env:"TERRABOARD_PORT" yaml:"port" description:"Port to listen on." default:"8080"`
	SwaggerPort uint16 `` /* 129-byte string literal not displayed */
	BaseURL     string `long:"base-url" env:"TERRABOARD_BASE_URL" yaml:"base-url" description:"Base URL." default:"/"`
	LogoutURL   string `long:"logout-url" env:"TERRABOARD_LOGOUT_URL" yaml:"logout-url" description:"Logout URL."`
}

WebConfig stores the UI interface parameters

Jump to

Keyboard shortcuts

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