Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Exists ¶
func Exists(fs Filesystem) (bool, error)
Exists checks if the configuration file exists. It returns a boolean indicating the existence of the file and any error encountered.
Types ¶
type Config ¶
type Config struct { // WhoAmI indicates whether to prepend the user's identity to the output. WhoAmI bool `json:"prepend-whoami"` // AllowList is a list of allowed entities for the application. AllowList []string `json:"allow-list"` }
Config represents the conditioners configuration. It includes fields for user preferences and settings.
func Read ¶
func Read(fs Filesystem) (*Config, error)
Read is a placeholder function for reading the configuration file.
type FS ¶
type FS struct{}
FS implements the Filesystem interface using the os package.
func (FS) ReadFile ¶
ReadFile reads the file named by `name` and returns the contents. It leverages os.ReadFile to read the file and return its contents along with any error encountered.
func (FS) Stat ¶
Stat returns the FileInfo structure describing the file. It uses os.Stat to obtain the FileInfo of the specified file, returning any errors encountered.
type Filesystem ¶
type Filesystem interface { // ReadFile reads the file named by `name` and returns the contents. // It returns the file contents as a byte slice and any error encountered. ReadFile(name string) ([]byte, error) // Stat returns the FileInfo structure describing the file. // If there is an error, it will be of type *PathError. Stat(name string) (os.FileInfo, error) // WriteFile writes data to a file named by `name`. // If the file does not exist, WriteFile creates it with permissions `perm`; // otherwise WriteFile truncates it before writing. WriteFile(name string, data []byte, perm os.FileMode) error }
Filesystem defines the operations available for interacting with the filesystem. It provides an abstraction over the standard file operations, allowing for easier testing and mocking.