Documentation
¶
Index ¶
- Constants
- Variables
- func ContainsConfigFile(configDir string, recursive bool) bool
- func FindLocalConfigFile(configDir string) string
- func GetGlobalConfigDir() (string, error)
- func MergeCliConfigIfExists(configDir string)
- func SetCliConfig(logLevel string)
- func ValidateConfigExists(configDir string) error
- func WriteLocalConfigValue(configDir string, key string, value string) error
- func WriteProjectConfig(configDir string, projectConfig ProjectConfig, forceOverwrite bool)
- type CliConfig
- type ConfigPair
- type ProjectConfig
Constants ¶
const DevCliVersion = "dev"
const GlobalConfigFileName = "config"
The GlobalConfigFileName is the file name without the file extension.
const LegacyLocalDirConfigFileName = ".imposter"
The LegacyLocalDirConfigFileName is the deprecated local project config file name, without the file extension. It is still honoured for backward compatibility, but takes lower precedence than LocalDirConfigFileName.
const LocalDirConfigFileName = "imposter-project"
The LocalDirConfigFileName is the canonical local project config file name, without the file extension.
Variables ¶
var ( Config CliConfig DirPath string )
Functions ¶
func ContainsConfigFile ¶
ContainsConfigFile determines if the specified configDir contains a file match the expected naming format
func FindLocalConfigFile ¶ added in v1.11.0
FindLocalConfigFile returns the path to an existing local project config file in configDir, preferring the canonical name over the legacy name (and yaml over other extensions). It returns an empty string if none exists.
func GetGlobalConfigDir ¶
func MergeCliConfigIfExists ¶
func MergeCliConfigIfExists(configDir string)
func SetCliConfig ¶
func SetCliConfig(logLevel string)
func ValidateConfigExists ¶
ValidateConfigExists checks that configDir is a directory containing at least one mock configuration file. Scaffolding of missing config is the caller's responsibility.
func WriteLocalConfigValue ¶
func WriteProjectConfig ¶ added in v1.11.0
func WriteProjectConfig(configDir string, projectConfig ProjectConfig, forceOverwrite bool)
WriteProjectConfig writes a local project config file (imposter-project.yaml) to configDir using the canonical file name.
Types ¶
type ConfigPair ¶
func ParseConfig ¶
func ParseConfig(args []string) []ConfigPair
type ProjectConfig ¶ added in v1.11.0
ProjectConfig holds the values used to scaffold a local project config file.