config

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const DevCliVersion = "dev"
View Source
const GlobalConfigFileName = "config"

The GlobalConfigFileName is the file name without the file extension.

View Source
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.

View Source
const LocalDirConfigFileName = "imposter-project"

The LocalDirConfigFileName is the canonical local project config file name, without the file extension.

Variables

View Source
var (
	Config  CliConfig
	DirPath string
)

Functions

func ContainsConfigFile

func ContainsConfigFile(configDir string, recursive bool) bool

ContainsConfigFile determines if the specified configDir contains a file match the expected naming format

func FindLocalConfigFile added in v1.11.0

func FindLocalConfigFile(configDir string) string

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 GetGlobalConfigDir() (string, error)

func MergeCliConfigIfExists

func MergeCliConfigIfExists(configDir string)

func SetCliConfig

func SetCliConfig(logLevel string)

func ValidateConfigExists

func ValidateConfigExists(configDir string) error

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 WriteLocalConfigValue(configDir string, key string, value string) error

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 CliConfig

type CliConfig struct {
	Version  string
	LogLevel string
}

type ConfigPair

type ConfigPair struct {
	Key   string
	Value string
}

func ParseConfig

func ParseConfig(args []string) []ConfigPair

type ProjectConfig added in v1.11.0

type ProjectConfig struct {
	Version string
	Plugins []string
}

ProjectConfig holds the values used to scaffold a local project config file.

Jump to

Keyboard shortcuts

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