Documentation
¶
Index ¶
Constants ¶
const ( ExpectedMinAzureCliVersion = "2.39.0" ExpectedMinTerraformVersion = "1.2.8" ExpectedMinHelmVersion = "3.8.2" ExpectedMinKubectlVersion = "1.23.9" ExpectedMinCopsctlVersion = "0.8.4" ExpectedMinSopsVersion = "3.7.3" )
Variables ¶
var ProjectBasePath = filepath.Join(".", "../", "../")
ProjectBasePath simply points to root of the Go project, which should always be two levels above the currently executed directory (which per convention, should always be cmd/project_name
Functions ¶
This section is empty.
Types ¶
type HQ ¶
type HQ interface { // Run starts the HQ CLI parsing functionality Run() error // GetExecutor retrieves the currently configured executor GetExecutor() commands.Executor // GetCli retrieves the current cli instance GetCli() cli.Cli // GetLogrusLogger retrieves the currently initialized logrus logger GetLogrusLogger() *logrus.Logger // LoadEnvironmentConfigFile is a special version of LoadConfigFile in which the config file is expected in // the location 'config/<<environment_tag>>.yaml'. This command relies on the defined variable // 'environment-tag', available through Viper. Most common way to provide the 'environment-tag' is through cli // parameters, which are automatically bound to Viper. LoadEnvironmentConfigFile() error // LoadConfigFile loads the specified config file, which is expected to be saved encrypted (with sops) on disk. // You can generate the path using filepath.Join and the hq.ProjectBasePath variable. Sops is expected to be // available in PATH, and in correct version (use the CheckToolingDependencies method or call hq 'check-dependencies') LoadConfigFile(filePath string) error // GetRawConfigurationFile returns the currently loaded configuration decrypted as string. Loading configuration is // a procondition due to get raw configuration string GetRawConfigurationFile() (string, error) // CheckToolingDependencies can be called to check if installed tooling (Azure CLI, Terraform, Helm etc.) is of minimal // expected version for all of HQ functionality to work. It is highly recommended to call this method in your code, and fail // in case of errors. CheckToolingDependencies() error }
HQ is an easy one-stop setup for typical IaC projects. Don't forget to call the Run() method after you complete setting up (e.g. all CLI commands added to HQ.Cli). Consider this object similar to an IoC container, which can be used to retrieve main dependencies for other objects, such as the command executor or the CLI.
func New ¶
New creates a new HQ instance, configuring internally used modules for usage. Keep the created HQ instance and avoid re-instantiation since some setup steps might have global impacts (like logging setup). It will create a chatty executor, piping all commands and outputs to both the console and the file (e.g. like in shell scripts)
func NewCustom ¶
NewCustom creates a new HQ instance, configuring internally used modules for usage. Keep the created HQ instance and avoid re-instantiation since some setup steps might have global impacts (like logging setup). Custom HQ lets you override most of the behaviours and HQ setup options
func NewQuiet ¶
NewQuiet creates a new HQ instance, configuring internally used modules for usage. Keep the created HQ instance and avoid re-instantiation since some setup steps might have global impacts (like logging setup). Quiet HQ will create a quiet executor, piping all commands and outputs to the log file, but the console will be kept clean. If needed, like in CI, a viper flag "verbose" can be used to override this behavior.
type HqOptions ¶
type HqOptions struct { // Quiet HQ will create a quiet executor, piping all commands and outputs to the log file, but the console will be // kept clean. If needed, like in CI, a viper flag "verbose" can be used to override this behavior. Quiet bool // Filename for the log file, if enabled LogFileName string // Default logging to file can be disabled with this flag DisableFileLogging bool }