opentofu/internal/command/system/config.go
Andrei Ciobanu a7435277ed
Extract global configurations in one struct (#4072)
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
2026-05-19 15:32:44 +03:00

56 lines
2.3 KiB
Go

// Copyright (c) The OpenTofu Authors
// SPDX-License-Identifier: MPL-2.0
// Copyright (c) 2023 HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package system
// Config it's just a wrapper that for the moment is used by the command.Meta
// to unify the global system configuration, like env vars, global plugins directory,
// and others.
//
// TODO meta-refactor: once things got cleaned up from Meta, the logic that generates the values
// for the attributes of this struct should be moved to this package.
type Config struct {
// RunningInAutomation indicates that commands are being run by an
// automated system rather than directly at a command prompt.
//
// This is a hint to various command routines that it may be confusing
// to print out messages that suggest running specific follow-up
// commands, since the user consuming the output will not be
// in a position to run such commands.
//
// The intended use-case of this flag is when OpenTofu is running in
// some sort of workflow orchestration tool which is abstracting away
// the specific commands being run.
RunningInAutomation bool
// CLIConfigDir is the directory from which CLI configuration files were
// read by the caller and the directory where any changes to CLI
// configuration files by commands should be made.
//
// If this is empty then no configuration directory is available and
// commands which require one cannot proceed.
CLIConfigDir string
// PluginCacheDir, if non-empty, enables caching of downloaded plugins
// into the given directory.
PluginCacheDir string
// GlobalPluginDirs contains additional paths to search for plugins
GlobalPluginDirs []string
// AllowExperimentalFeatures controls whether the current build of OpenTofu
// has experimental features enabled.
//
// In normal code this would be set by package main only in builds
// explicitly marked as being alpha releases or development snapshots,
// making experimental features unavailable otherwise. Test code may
// choose to set this if it needs to exercise experimental features.
//
// Some experiments predated the addition of this setting, and may
// therefore still be available even if this flag is false. Our intent
// is that all/most _future_ experiments will be unavailable unless this
// flag is set, to reinforce that experiments are not for production use.
AllowExperimentalFeatures bool
}